coding utf-8 from django db import models from quest const import ANSW

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-
from django.db import models
#from quest.const import ANSWER_TYPE_CHOICES
class Test(models.Model):
name = models.CharField(max_length=255)
category = models.ForeignKey('Category')
desc_short = models.TextField()
desc_full = models.TextField()
def __unicode__(self):
return self.name
class Category(models.Model):
name = models.CharField(max_length=255)
def __unicode__(self):
return self.name
class Question(models.Model):
body = models.TextField()
number = models.IntegerField()
test = models.ForeignKey(Test)
def __unicode__(self):
return self.body
class Meta:
ordering = ['number']
class Answer(models.Model):
question = models.ForeignKey(Question)
body = models.TextField()
#type= models.CharField(max_length=10, choices=ANSWER_TYPE_CHOICES)
def __unicode__(self):
return self.body