added ability to lock out external survey answering people but still allow logged in users to use the same interface to transcribe paper surveys
parent
669ee7501d
commit
5ae7ce8c13
|
@ -76,6 +76,7 @@ class Questionnaire(models.Model):
|
|||
redirect_url = models.CharField(max_length=128, help_text="URL to redirect to when Questionnaire is complete. Macros: $SUBJECTID, $RUNID, $LANG", default="/static/complete.html")
|
||||
html = models.TextField(u'Html', blank=True)
|
||||
parse_html = models.BooleanField("Render html instead of name for survey?", null=False, default=False)
|
||||
admin_access_only = models.BooleanField("Only allow access to logged in users? (This allows entering paper surveys without allowing new external submissions)", null=False, default=False)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
|
|
@ -372,6 +372,10 @@ def questionnaire(request, runcode=None, qs=None):
|
|||
commit()
|
||||
return HttpResponseRedirect('/')
|
||||
|
||||
if runinfo.questionset.questionnaire.admin_access_only == 1:
|
||||
if not request.user.is_superuser:
|
||||
return HttpResponseRedirect(runinfo.questionset.questionnaire.redirect_url)
|
||||
|
||||
# let the runinfo have a piggy back ride on the request
|
||||
# so we can easily use the runinfo in places like the question processor
|
||||
# without passing it around
|
||||
|
|
Loading…
Reference in New Issue