1 from django.db import models |
|
2 |
|
3 # Create your models here. |
|
4 from django.db import models |
|
5 |
|
6 |
|
7 mutable = True |
|
8 |
|
9 class Element(models.Model): |
|
10 paragraph_id = models.CharField('Paragraph Id', max_length=100, editable=False, primary_key=True) |
|
11 chapter_name = models.CharField('Chapter name', max_length=100, editable=False,db_index=True) |
|
12 |
|
13 |
|
14 def __unicode__(self): |
|
15 return self.paragraph_id |
|
16 |
|
17 class Comment(models.Model): |
|
18 element = models.ForeignKey(Element, |
|
19 help_text='ID of paragraph that was commented on') |
|
20 comment = models.TextField(editable=mutable, |
|
21 help_text='Text of submitted comment (please do not modify)') |
|
22 submitter_name = models.CharField('Submitter', max_length=64, |
|
23 help_text='Self-reported name of submitter (may be bogus)') |
|
24 submitter_url = models.URLField('URL', blank=True, editable=mutable, |
|
25 help_text='Self-reported URL of submitter (may be empty or bogus)') |
|
26 ip = models.IPAddressField('IP address', editable=mutable, |
|
27 help_text='IP address from which comment was submitted') |
|
28 date = models.DateTimeField('date submitted', auto_now=True, |
|
29 auto_now_add=True) |
|
30 |
|
31 def __unicode__(self): |
|
32 return self.comment[:32] |
|
33 |
|
34 |
|