Friday, January 20, 2012

Why can't erase this model object? "AssertionError: Question object can't be deleted because its id attribute is set to None."

I get the following error when attempting to delete an object of my
model...

"AssertionError: Question object can't be deleted because its id
attribute is set to None."

The class definition is thus...

class Question(django.db.models.Model):
"""
Represents a database table.
"""

subject = django.db.models.CharField(max_length = 1000)
section = django.db.models.CharField(max_length = 1000)
text = django.db.models.CharField(max_length = 1000)
answer = django.db.models.CharField(max_length = 1000)
answer_type = django.db.models.CharField(max_length = 1000)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment