Anonymous posting issue

39 views
Skip to first unread message

Bayard Randel

unread,
Nov 17, 2012, 10:32:27 PM11/17/12
to django-cro...@googlegroups.com
Hi there,

I'm having an issue where POSTs to /api/embeded_survey_questions when no user is logged in result in the form just being returned in the response without apparently submitting or validating. When the user has logged in via the django admin everything works as expected however. This is less than ideal as we want to be running anonymous surveys. I'm running django-crowdsouring in django 1.4.2.

Many thanks!

Bayard Randel

unread,
Nov 18, 2012, 4:50:39 PM11/18/12
to django-cro...@googlegroups.com
The issue appears to be in the forms_for_survey() method in forms.py:

post is set to none if the user is not authenticated:

    def forms_for_survey(survey, request='testing', submission=None):
        testing = bool(not request.user.is_authenticated() or request == 'testing')
        session_key = "" if testing else request.session.session_key.lower()
        post = None if testing else request.POST or None

suggest instead that this should be:

    def forms_for_survey(survey, request='testing', submission=None):
        testing = bool(request == 'testing')
        session_key = "" if testing else request.session.session_key.lower()
        post = None if testing else request.POST or None
Reply all
Reply to author
Forward
0 new messages