I am pasting in a pretty basic models.py here. It is fairly classic (I
actually started with Poll tutorial example) and I have stripped out
anything that looks questionable. Through the standard admin
interface, I can create a User8, a Documentversion8, and a Document8.
However, after I fill out the form for Quiz8 and save it, I get a
server error (500).
---
from django.db import models
import datetime
class User8(models.Model):
name = models.CharField(max_length=150, unique=True)
creation_time = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return
self.name
class Documentversion8(models.Model):
version = models.CharField(max_length=150, unique=True)
creation_time = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return self.version
class Document8(models.Model):
document_title = models.CharField(max_length=150)
document_url = models.CharField(max_length=200, unique=True)
document_owner = models.ForeignKey("User8", blank=True, null=True)
document_version = models.ForeignKey('Documentversion8', blank=True,
null=True)
creation_time = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return self.document_url
class Quiz8(models.Model):
quiz_owner = models.ForeignKey("User8", blank=True, null=True)
document = models.ForeignKey('Document8')
creation_time = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return self.document
class Question8(models.Model):
question_text = models.TextField()
# All the following must eventually be filled in, but it should be
# possible to save the question before filling them all in.
number = models.IntegerField(blank=True, null=True)
maximum = models.IntegerField(blank=True, null=True)
correct = models.IntegerField(blank=True, null=True)
quiz = models.ForeignKey('Quiz8')
def __unicode__(self):
return self.question_text
class Answer8(models.Model):
answer_text = models.TextField()
# All the following must eventually be filled in, but it should be
# possible to save the answer before filling them all in.
number = models.IntegerField(blank=True, null=True)
question = models.ForeignKey("Question8", blank=True, null=True)
# The following is filled in by the program when saving the
submitter's answer.
ipaddr = models.CharField(max_length=40, blank=True)
def __unicode__(self):
return self.answer_text
class Submission8(models.Model):
quiz = models.ForeignKey("Quiz8")
documentversion = models.ForeignKey('Documentversion8', null=True)
time = models.DateTimeField(auto_now_add=True)
answered = models.IntegerField()
unanswered = models.IntegerField()
correct = models.IntegerField()
# The following is filled in by the program when saving the
submitter's answer.
ipaddr = models.CharField(max_length=40)
creation_time = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return
self.id