survey form

19 views
Skip to first unread message

sum abiut

unread,
Mar 20, 2018, 10:18:25 PM3/20/18
to django...@googlegroups.com
Hi,
I am planning to build a survey app that allow the administator to add new questioner and the question to be answer by the users.But i am having trouble figuring how to get started. Just wondering if i need to have two models one for the answes and another model to store the questions. I need some directions.

cheers

Mike Dewhirst

unread,
Mar 21, 2018, 12:22:32 AM3/21/18
to django...@googlegroups.com, sum abiut
The official Django tutorial builds a poll app. I could be wrong but
that sounds like exactly what you want.

https://docs.djangoproject.com/en/2.0/intro/tutorial01/


>
> cheers
> --
> 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
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@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/CAPCf-y5uR9m%3Diu7XdJEJAg%2B4Oj9EpCVrZg2_ipzrSbBUuaYPGg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPCf-y5uR9m%3Diu7XdJEJAg%2B4Oj9EpCVrZg2_ipzrSbBUuaYPGg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

sum abiut

unread,
Mar 21, 2018, 2:02:44 AM3/21/18
to Mike Dewhirst, django...@googlegroups.com
Thanks heaps Mike.


On Wed, Mar 21, 2018 at 3:21 PM, Mike Dewhirst <mi...@dewhirst.com.au> wrote:
On 21/03/2018 1:17 PM, sum abiut wrote:
Hi,
I am planning to build a survey app that allow the administator to add new questioner and the question to be answer by the users.But i am having trouble figuring how to get started. Just wondering if i need to have two models one for the answes and another model to store the questions. I need some directions.

The official Django tutorial builds a poll app. I could be wrong but that sounds like exactly what you want.

https://docs.djangoproject.com/en/2.0/intro/tutorial01/



cheers

--
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+unsubscribe@googlegroups.com <mailto:django-users+unsubscrib...@googlegroups.com>.
To post to this group, send email to django...@googlegroups.com <mailto:django-users@googlegroups.com>.




--
______________________________________________________________
                                         | Sum Abiut |

Security Blog : Security Tips  | Programming  Blog: Programming

sum abiut

unread,
Mar 26, 2018, 5:30:17 PM3/26/18
to Mike Dewhirst, django...@googlegroups.com
i have build an app that allow the admin to add survey title, question and choices. I needed assistance display all the questions and answer in front end to allow the users to take the survey. can i do that with a form. needed  directions.

my models.py

class Survey(models.Model):
    title = models.CharField(max_length = 200,blank=True)
    def __unicode__(self):
        return self.title

class Question(models.Model):
  
    question_text=models.CharField(max_length=100,blank=True)
    Survey_Title = models.ForeignKey(Survey,on_delete=models.CASCADE,default="")
    def __unicode__(self):
        return self.question_text




class answer(models.Model):
 
    question=models.ForeignKey(Question,on_delete=models.CASCADE)
    answer_text=models.CharField(max_length=200,blank=True,default="")
    option=(
                ('Yes','Yes'),
                ('No','No'),

    )
    Selection_an_Option=models.CharField(max_length=100,choices=option,blank=True,default="")
    def __unicode__(self):
        return self.answer_text


class SurveyAnswer(models.Model):
    orig_survey = models.ForeignKey(Survey,on_delete=models.CASCADE)

class QuestionAnswer(models.Model):
    answer = models.ForeignKey(answer,on_delete=models.CASCADE)
    survey_answer = models.ForeignKey(SurveyAnswer,on_delete=models.CASCADE)


Cheers
Reply all
Reply to author
Forward
0 new messages