I'm completely new to Django coming from PHP and therefore struggling a little with the terminology. This makes searching for an answer quite hard. Hopefully, somebody can tell me if this can be done within the excellent Django admin.
Ok, so the idea is that I have a questionaire which will be filled in by members of the design world. The questionaire class has very few fields, title, introduction, date.
The questions have their own class, there is a limited number in this case 20 and they are the same on each questionaire.
Therefore I have an answers class, the answer belongs to both a questionaire and a question.
class Questionaire(models.Model):
title = models.CharField(max_length=255)
intro = models.TextField(max_length=4000)
date_entered = models.DateField()
date_modified = models.DateField()
def __unicode__(self):
return self.title
class Question(models.Model):
title = models.CharField(max_length=255)
number = models.IntegerField()
def __unicode__(self):
return self.title
class Answer(models.Model):
response = models.TextField(max_length=4000)
questionaire = models.ForeignKey('articles.Questionaire')
question = models.ForeignKey('articles.Question')
def __unicode__(self):
return self.response
Sorry about the formatting above What I am needing in the Questionaire admin is for each question, an answer field is available inline. If possible with the question name as the form field name.
Is this possible within Django admin?
Would be most grateful for any assistance