sphinx_django/sphinxcomment/models.py
author amit
Fri, 15 Oct 2010 15:59:28 +0530
changeset 2 f5e18f8ed036
parent 0 54f784230511
permissions -rw-r--r--
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     1
from django.db import models
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     2
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     3
# Create your models here.
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     4
from django.db import models
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     5
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     6
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     7
mutable = True
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     8
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
     9
class Element(models.Model):
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    10
    paragraph_id = models.CharField('Paragraph Id', max_length=100, editable=False, primary_key=True) 
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    11
    chapter_name = models.CharField('Chapter name', max_length=100, editable=False,db_index=True)
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    12
    
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    13
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    14
    def __unicode__(self):
2
f5e18f8ed036 Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents: 0
diff changeset
    15
        return self.paragraph_id
0
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    16
    
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    17
class Comment(models.Model):
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    18
    element = models.ForeignKey(Element,
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    19
        help_text='ID of paragraph that was commented on')
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    20
    comment = models.TextField(editable=mutable,
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    21
        help_text='Text of submitted comment (please do not modify)')
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    22
    submitter_name = models.CharField('Submitter', max_length=64,
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    23
        help_text='Self-reported name of submitter (may be bogus)')
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    24
    submitter_url = models.URLField('URL', blank=True, editable=mutable,
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    25
        help_text='Self-reported URL of submitter (may be empty or bogus)')
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    26
    ip = models.IPAddressField('IP address', editable=mutable,
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    27
        help_text='IP address from which comment was submitted')
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    28
    date = models.DateTimeField('date submitted', auto_now=True,
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    29
                                auto_now_add=True)
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    30
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    31
    def __unicode__(self):
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    32
        return self.comment[:32]
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    33
54f784230511 Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff changeset
    34