Re: Views, Forms not working.
Nick - I removed some irrelevant stuff earlier, and removed those tags by mistake. Cheers, N// Regards, Nigel Legg 07914 740972 http://twitter.com/nigellegg http://uk.linkedin.com/in/nigellegg On 1 July 2013 22:20, Nick Dokos wrote: > Nigel Legg writes: > > > template datatables.html: > > > > > > > > Make Tables > > > > > > enctype="multipart/formdata">{% csrf_token %} > > > > {{ form.datFile.label_tag }} {{ form.datFile }} > > > {{ form.structFile.label_tag }} {{ > form.structFile }} > > {{ form.bannerVar.label_tag}} {{ form.bannerVar > }} > > {{ form.stubVar.label_tag}} {{ form.stubVar }} > > > {{ form.stubNets.label_tag }} {{ form.stubNets > }} > > > > /> > > > > > > > > > > Nothing to do with the problem, so just an fyi: and are > missing. > > -- > Nick > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Views, Forms not working.
Nigel Legg writes: > template datatables.html: > > > > Make Tables > > > enctype="multipart/formdata">{% csrf_token %} > > {{ form.datFile.label_tag }} {{ form.datFile }} > {{ form.structFile.label_tag }} {{ form.structFile }} > > {{ form.bannerVar.label_tag}} {{ form.bannerVar }} > > {{ form.stubVar.label_tag}} {{ form.stubVar }} > {{ form.stubNets.label_tag }} {{ form.stubNets }} > > > > > > Nothing to do with the problem, so just an fyi: and are missing. -- Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Views, Forms not working.
Ah yes, thank you. Regards, Nigel Legg 07914 740972 http://twitter.com/nigellegg http://uk.linkedin.com/in/nigellegg On 1 July 2013 15:53, Mário Idival wrote: > Oh, but the url 'list'? remove the url 'list' of actions in forms > > > 2013/7/1 Nigel Legg > >> Tried that, still going back to the index page. >> >> Regards, >> Nigel Legg >> 07914 740972 >> http://twitter.com/nigellegg >> http://uk.linkedin.com/in/nigellegg >> >> >> >> On 1 July 2013 15:33, Mário Idival wrote: >> >>> """ >>> form.is_valid(): >>> model_instance.save() >>> >>> """ >>> >>> form.is_valid(): >>> form.save() >>> >>> >>> >>> >>> 2013/7/1 Nigel Legg >>> So I have: views.py: def datatables(request): if request.method == 'POST': form = DataTableForm(request.POST) if form.is_valid(): model_instance.save() return redirect('myapp/tabspec.html') else: form = DataTableForm() return render(request, 'myapp/datatables.html', { 'form': form, }) template datatables.html: Make Tables >>> enctype="multipart/formdata">{% csrf_token %} {{ form.datFile.label_tag }} {{ form.datFile }} {{ form.structFile.label_tag }} {{ form.structFile }} {{ form.bannerVar.label_tag}} {{ form.bannerVar }} {{ form.stubVar.label_tag}} {{ form.stubVar }} {{ form.stubNets.label_tag }} {{ form.stubNets }} models.py: class DataTable(models.Model): datFile = models.CharField(max_length = 200) structFile = models.CharField(max_length = 200) bannerVar = models.CharField(max_length = 50) stubVar = models.CharField(max_length = 50) stubNets = models.BooleanField() and forms.py: class DataTableForm(forms.ModelForm): class Meta: model = DataTable The form shows fine (see image), but when I click the button it goes back to the index page, which isn't what I wanted to happen. Any thoughts on where I am going wrong? Cheers N // Regards, Nigel Legg 07914 740972 http://twitter.com/nigellegg http://uk.linkedin.com/in/nigellegg -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >>> -- >>> Mário Idival >>> >>> *Twitter *: *@marioigd* >>> *Facebook*: *mario.idival* >>> *User Linux : **#554446* >>> Skype*: marioidival* >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-users+unsubscr...@googlegroups.com. >>> To post to this group, send email to django-users@googlegroups.com. >>> Visit this group at http://groups.google.com/group/django-users. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/django-users. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > Mário Idival > > *Twitter *: *@marioigd* > *Facebook*: *mario.idival* > *User Linux : **#554446* > Skype*: marioidival* > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Views, Forms not working.
Oh, but the url 'list'? remove the url 'list' of actions in forms 2013/7/1 Nigel Legg > Tried that, still going back to the index page. > > Regards, > Nigel Legg > 07914 740972 > http://twitter.com/nigellegg > http://uk.linkedin.com/in/nigellegg > > > > On 1 July 2013 15:33, Mário Idival wrote: > >> """ >> form.is_valid(): >> model_instance.save() >> >> """ >> >> form.is_valid(): >> form.save() >> >> >> >> >> 2013/7/1 Nigel Legg >> >>> So I have: >>> views.py: >>> def datatables(request): >>> if request.method == 'POST': >>> form = DataTableForm(request.POST) >>> if form.is_valid(): >>> model_instance.save() >>> return redirect('myapp/tabspec.html') >>> else: >>> form = DataTableForm() >>> return render(request, 'myapp/datatables.html', { >>> 'form': form, >>> }) >>> >>> template datatables.html: >>> >>> >>> >>> Make Tables >>> >>> >>> >> enctype="multipart/formdata">{% csrf_token %} >>> >>> {{ form.datFile.label_tag }} {{ form.datFile }} >>> {{ form.structFile.label_tag }} {{ form.structFile }} >>> {{ form.bannerVar.label_tag}} {{ form.bannerVar }} >>> {{ form.stubVar.label_tag}} {{ form.stubVar }} >>> {{ form.stubNets.label_tag }} {{ form.stubNets }} >>> >>> >>> >>> >>> >>> >>> models.py: >>> class DataTable(models.Model): >>> datFile = models.CharField(max_length = 200) >>> structFile = models.CharField(max_length = 200) >>> bannerVar = models.CharField(max_length = 50) >>> stubVar = models.CharField(max_length = 50) >>> stubNets = models.BooleanField() >>> >>> and forms.py: >>> class DataTableForm(forms.ModelForm): >>> class Meta: >>> model = DataTable >>> >>> The form shows fine (see image), but when I click the button it goes >>> back to the index page, which isn't what I wanted to happen. Any thoughts >>> on where I am going wrong? >>> Cheers N // >>> >>> Regards, >>> Nigel Legg >>> 07914 740972 >>> http://twitter.com/nigellegg >>> http://uk.linkedin.com/in/nigellegg >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-users+unsubscr...@googlegroups.com. >>> To post to this group, send email to django-users@googlegroups.com. >>> Visit this group at http://groups.google.com/group/django-users. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> >> >> -- >> Mário Idival >> >> *Twitter *: *@marioigd* >> *Facebook*: *mario.idival* >> *User Linux : **#554446* >> Skype*: marioidival* >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/django-users. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Mário Idival *Twitter *: *@marioigd* *Facebook*: *mario.idival* *User Linux : **#554446* Skype*: marioidival* -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Views, Forms not working.
Tried that, still going back to the index page. Regards, Nigel Legg 07914 740972 http://twitter.com/nigellegg http://uk.linkedin.com/in/nigellegg On 1 July 2013 15:33, Mário Idival wrote: > """ > form.is_valid(): > model_instance.save() > > """ > > form.is_valid(): > form.save() > > > > > 2013/7/1 Nigel Legg > >> So I have: >> views.py: >> def datatables(request): >> if request.method == 'POST': >> form = DataTableForm(request.POST) >> if form.is_valid(): >> model_instance.save() >> return redirect('myapp/tabspec.html') >> else: >> form = DataTableForm() >> return render(request, 'myapp/datatables.html', { >> 'form': form, >> }) >> >> template datatables.html: >> >> >> >> Make Tables >> >> >> > enctype="multipart/formdata">{% csrf_token %} >> >> {{ form.datFile.label_tag }} {{ form.datFile }} >> {{ form.structFile.label_tag }} {{ form.structFile }} >> {{ form.bannerVar.label_tag}} {{ form.bannerVar }} >> {{ form.stubVar.label_tag}} {{ form.stubVar }} >> {{ form.stubNets.label_tag }} {{ form.stubNets }} >> >> >> >> >> >> >> models.py: >> class DataTable(models.Model): >> datFile = models.CharField(max_length = 200) >> structFile = models.CharField(max_length = 200) >> bannerVar = models.CharField(max_length = 50) >> stubVar = models.CharField(max_length = 50) >> stubNets = models.BooleanField() >> >> and forms.py: >> class DataTableForm(forms.ModelForm): >> class Meta: >> model = DataTable >> >> The form shows fine (see image), but when I click the button it goes back >> to the index page, which isn't what I wanted to happen. Any thoughts on >> where I am going wrong? >> Cheers N // >> >> Regards, >> Nigel Legg >> 07914 740972 >> http://twitter.com/nigellegg >> http://uk.linkedin.com/in/nigellegg >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/django-users. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > Mário Idival > > *Twitter *: *@marioigd* > *Facebook*: *mario.idival* > *User Linux : **#554446* > Skype*: marioidival* > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Views, Forms not working.
""" form.is_valid(): model_instance.save() """ form.is_valid(): form.save() 2013/7/1 Nigel Legg > So I have: > views.py: > def datatables(request): > if request.method == 'POST': > form = DataTableForm(request.POST) > if form.is_valid(): > model_instance.save() > return redirect('myapp/tabspec.html') > else: > form = DataTableForm() > return render(request, 'myapp/datatables.html', { > 'form': form, > }) > > template datatables.html: > > > > Make Tables > > > enctype="multipart/formdata">{% csrf_token %} > > {{ form.datFile.label_tag }} {{ form.datFile }} > {{ form.structFile.label_tag }} {{ form.structFile }} > {{ form.bannerVar.label_tag}} {{ form.bannerVar }} > {{ form.stubVar.label_tag}} {{ form.stubVar }} > {{ form.stubNets.label_tag }} {{ form.stubNets }} > > > > > > > models.py: > class DataTable(models.Model): > datFile = models.CharField(max_length = 200) > structFile = models.CharField(max_length = 200) > bannerVar = models.CharField(max_length = 50) > stubVar = models.CharField(max_length = 50) > stubNets = models.BooleanField() > > and forms.py: > class DataTableForm(forms.ModelForm): > class Meta: > model = DataTable > > The form shows fine (see image), but when I click the button it goes back > to the index page, which isn't what I wanted to happen. Any thoughts on > where I am going wrong? > Cheers N // > > Regards, > Nigel Legg > 07914 740972 > http://twitter.com/nigellegg > http://uk.linkedin.com/in/nigellegg > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Mário Idival *Twitter *: *@marioigd* *Facebook*: *mario.idival* *User Linux : **#554446* Skype*: marioidival* -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Views, Forms not working.
So I have: views.py: def datatables(request): if request.method == 'POST': form = DataTableForm(request.POST) if form.is_valid(): model_instance.save() return redirect('myapp/tabspec.html') else: form = DataTableForm() return render(request, 'myapp/datatables.html', { 'form': form, }) template datatables.html: Make Tables {% csrf_token %} {{ form.datFile.label_tag }} {{ form.datFile }} {{ form.structFile.label_tag }} {{ form.structFile }} {{ form.bannerVar.label_tag}} {{ form.bannerVar }} {{ form.stubVar.label_tag}} {{ form.stubVar }} {{ form.stubNets.label_tag }} {{ form.stubNets }} models.py: class DataTable(models.Model): datFile = models.CharField(max_length = 200) structFile = models.CharField(max_length = 200) bannerVar = models.CharField(max_length = 50) stubVar = models.CharField(max_length = 50) stubNets = models.BooleanField() and forms.py: class DataTableForm(forms.ModelForm): class Meta: model = DataTable The form shows fine (see image), but when I click the button it goes back to the index page, which isn't what I wanted to happen. Any thoughts on where I am going wrong? Cheers N // Regards, Nigel Legg 07914 740972 http://twitter.com/nigellegg http://uk.linkedin.com/in/nigellegg -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out. <>