一个创建基于网络的匿名调查的django应用程序

django-anonsurve的Python项目详细描述


anonsurvey是一个django应用程序,用于创建基于web的匿名调查。

快速启动

  1. 将“anonsurvey”添加到已安装的应用程序设置中,如下所示:

    INSTALLED_APPS = (
        ...
        'anonsurvey',
    )
    
    维护管理还取决于:

    'tinymce', “sorl.缩略图”, 'MCE_文件浏览器',

  2. 在项目url.py中包含anonsurvey urlconf,如下所示:

    url(r'^survey/', include('anonsurvey.urls')),
    
  3. 运行python manage.py syncdb以创建anonsurvey模型。

  4. 启动开发服务器并访问http://127.0.0.1:8000/admin/ 创建调查(需要启用管理应用程序)。

  5. 访问http://127.0.0.1:8000/survey/列出调查。

创建调查

首先输入调查主数据:

  • title
  • name (which is a slug initialy created from title)
  • introduction text
  • active state (False by default).

然后你可以输入问题。对于每个问题,您都可以输入 问题所属的问题组。问题组是可选的。 问题数据是:

  • survey the question belongs to
  • optional question group
  • type of the question:
    • input - input type text
    • choice - input type radio group
    • multiple choice - input type checkboxes
    • choice with input - input type radio group with one radio input with type text
    • multiple choice with input - input type checkboxes with one checkbox with input type text
  • text of the question
  • requires answer
  • sort index - questions are sorted by this number ascending.

问题组包含它所属的调查和问题组 文本。

为每个问题定义答案或提供多个答案。 答案数据是:

  • type - input or choice - it is relevant only for choice with input and multiple choice with input question types
  • text prefix - displayed before input field of input type answer
  • text - displayed for choice type of answer
  • text sufix - displayed after input field of input type answer
  • default value - for input type of answer
  • validation regex - for input type of answer; regex is a valid python regex
  • sort index - answers are sorted by this number ascending.

根据调查定义,调查问题和提供的答案是 以不同的方式呈现。

首先,显示调查标题和简介文本。 然后根据排序索引值按顺序呈现问题。 如果问题属于问题组,则显示组的标题。 然后组的每个任务都在该组内呈现。 如果问题不属于任何组,则仅呈现该问题。 每个问题都会显示其文本。 在问题的下面,答案是按排序的顺序呈现的 索引值。 如果输入问题类型,则呈现输入字段。 在显示输入字段文本前缀之前。输入字段文本后 苏菲克斯展示。如果定义了默认值,则将呈现该值 在输入框内。 如果选择问题类型,则提供的答案显示为 广播组。每个收音机都是一个提供的答案,并显示其文本。 如果问题类型是多项选择,则显示提供的答案 作为复选框。每个复选框是一个提供的答案,其文本是 显示。 如果quesiton类型是带input的choice或带input的multiple choice 然后每一个答案都显示在上面供选择或多项选择 问题类型。这里答案的类型是相关的。如果类型是 输入然后其单选或复选框包含 呈现的问题类型与输入的问题类型相同。

提交完成的调查验证时:

  • if question requires answer then answer must be suplied
  • if answer type is input and validation regex is supplied then answer value must match defined regex (note that regex is prefixed and sufixe with ^ and $ so that whole string match is checked).

提交的答案数据是:

  • client_id - in the format <current_timestamp>@<remote_ip> (by this value you can group answers to one client that completed the survey)
  • datetime - current timestamp answer is saved
  • answer - foreign key to offered answer that is input/selected
  • text - input value for input type of offered answer.

在包中,有一些最简单的模板可用于 拥有。 用于测量显示 {%使用survey=survey%}的include“anonsurvey/survey_form.thml”。 此模板提供了一种根据 关于调查定义。你可以原样使用,也可以作为 你的模板。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
junit无法从另一个java类访问方法   java Android打开对话框   使用JUnit的java测试控制台输出   java使用信号量从2个线程打印可选输出   在Java中,如何计算字符串开头出现的字符数   多线程单元测试Java多线程socket服务器   java如何使用aspectj创建jar?日食   java出现意外错误(类型=内部服务器错误,状态=500)。org/eclipse/jdt/internal/compiler/env/INameEnvironment   java重用Tomcat配置在节点之间发送消息   swing如何在Java中的表中的列中添加复选框   java为什么这个程序显示错误?   java在Android中将编码的base64图像转换为文件对象   带H2的java Hibernate不存储数据   mysql建议:使用JFrame的Java GUI   JavaAntlr没有为Scala语法提供正确的输出标记   数学Java把负数变成1,把正数变成1   java如何将网页中的小程序包含在不同的目录中?