Hi,Yes csrf was missing, but got it working by changing render_to_response
to render.
Surprising that example code was not designed to work as such

Still I would like to get action buttons for each row. Admin view has at
least some kind of links in each row.
-thanks

2015-02-24 12:52 GMT+02:00 aRkadeFR <cont...@arkade.info>:

>  Please, print your variable request.POST on your
> view and see if the csrf_token is missing or not?
> Same for your formset variable :)
>
>
> On 02/24/2015 09:55 AM, joulumaa wrote:
>
> Thanks, but I did exactly that and still 403 csrf error, attached my
> template and related code
> thanks for help
>
> <form method="post" action="">
> {% csrf_token %}
>     <table>
>         {{ formset }}
>     </table>
>  <input type="submit" value="Submit" />
> </form>
>
> def school(request):
>     SchoolFormSet = modelformset_factory(SchoolHistory)
>     if request.method == 'post':
>         formset = SchoolFormSetSet(request.POST, request.FILES)
>         if formset.is_valid():
>             formset.save()
>             # do something.
>     else:
>         formset = SchoolFormSet()
>     return render_to_response("testformset.html", {
>         "formset": formset,
>     })
>
>
> tiistai 24. helmikuuta 2015 10.31.13 UTC+2 aRkadeFR kirjoitti:
>>
>>  Hello :)
>>
>> The template indeed doesn't show the submit button in the
>> documentation here:
>> https://docs.djangoproject.com/en/1.7/topics/forms/
>> formsets/#using-a-formset-in-views-and-templates
>>
>> In order to add the csrf token, you can use the template tag
>> {% csrf %} inside the form tag.
>> And add the submit button before closing the form tag too :)
>>
>> On 02/24/2015 01:09 AM, joulumaa wrote:
>>
>> Hi,
>> I just studied and created first modelFormSet, and tried to use it in
>> view.
>> I have same code in template as is in django documentation.
>> modelFormset shows data ok, but submit button is missing,why it is not in
>> example template in documentation?
>> ok, I added submit button like I have used with basic forms, it shows up
>> but cause csrf error,
>> then I added csrf tag as in form cases before, but still csrf  error....
>>
>> I am missing some information i guess???, any help for beginner...?
>>
>> -Vesa
>> btw, i would like to have that saving button on each row in formset....
>> is it possible?
>>  --
>> 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...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/ee930575-0a61-4c74-ad34-847df414f59c%
>> 40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/ee930575-0a61-4c74-ad34-847df414f59c%40googlegroups.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPHgOn5h873--AHkvFTzQfmdC0XWjFvZj-zQ8tJRXpnAUs2wAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to