I'd like to ask for you guidance in the following matter in django:
I am using the following models:
class QItem(models.Model):
isWhat = models.CharField(max_length=100, blank=True,
choices=ISWHAT)
slug = models.SlugField(blank=True)
script = models.CharField(max_length=100)
comment = models.TextField(blank=True, null=True)
author = models.ForeignKey(User)
class QuestionSet(QItem):
items = models.ManyToManyField(QItem, blank=True,
through='Ordering',related_name="contained")
class Question(QItem):
answerObject = models.OneToOneField("AnswerObject",
blank=True, null=True)
and their respective, most basic ModelForms:
class QuestionForm(ModelForm):
class Meta:
model = Question
class QuestionSetForm(ModelForm):
class Meta:
model = QuestionSet
In a view, calling
qset=QuestionFormSet()
print q
works just fine.
However,
q = QuestionForm()
print q
throws
Exception Type: AttributeError
Exception Value: 'NoneType' object has no attribute 'label'
in Django's server. When trying it in the console, I don't get any
errors.
Any ideas why this is the case? Why do similar models behave so
differently, and how could I get rid of the error?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.