On Wed, Jan 3, 2018 at 1:53 AM, Sumit Kumar <postme.su...@gmail.com> wrote:

> When I am using simply this
>
>                 <form action="" method="post" enctype="multipart/form-data">
>                     {% block content %}
>                        {% csrf_token %}
>                        {{ form }}
>                        <input type="submit" value="Update" />
>                     {% endblock content %}
>                 </form>
>
> It is updating my JobFinal Table I can see *POST
> /JobSchd/jobform_final/3/update/ HTTP/1.1" 302 0* But when changing {{
> form }} to {{ form.job_name }} It doesn't update the table and doesn't
> redirect to the reverse url.And I can see *POST
> /JobSchd/jobform_final/3/update/ HTTP/1.1" 200 4492*
>
Because {{ form }} makes the template engine print all the fields (and
error handling code) of the form, while {{ form.job_name }} will do it for
just the "job_name" field. If there are more fields required for the form
being valid, in the view it will never be succesful and the get_success_url
won't be executed. You won't see any error in the template because that is
printed by {{ form }} - which is not there


> Here is my snippet of related View.py
>
> class JobFinalUpdate(UpdateView):
>     model = JobFinal
>     form_class = JobFormFinal
>     template_name_suffix = '_update_form'
>
>
>     def get_success_url(self):
>         return reverse('JobSchd:user_details',kwargs={'pk': 
> self.request.user.id})
>
> Here is my form.py class JobFormFinal(forms.ModelForm):
>
> class Meta:
>     model=JobFinal
>     exclude=['user']
>
> Thank You!
> Kind Regards,
> Sumit Kumar| +1-480-740-7728
>
> Please consider the environment before printing.
>
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAOvNbK5MPctf16RfaZzcfc%3Dt4USd%2B3Ey0H0mm7hT%3DGeh_
> zbyug%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAOvNbK5MPctf16RfaZzcfc%3Dt4USd%2B3Ey0H0mm7hT%3DGeh_zbyug%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BFDnhJ4Occjs0LSSeTyy6iLtki2M%2BcB72TeJZnYgq8pdY2LQA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to