Код> Добавить | Пролистать [ r]
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class Resource(models.Model):
    """
    External documents, related to laws
    """

    SOURCE_CHOISES = ((0,'Source1'),
                      (1,'Source2'),
                      (2,'Source3'),) 

    title            = models.CharField(max_length=500)
    document         = models.FileField(blank=True, null=True, upload_to="uploads/documents/")
    sections         = models.ManyToManyField(Section)
    text             = models.TextField(null=True, blank=True)
    link             = models.CharField(max_length=255, null=True, blank=True)
    source_type      = models.IntegerField(choices=SOURCE_CHOISES, default=0)
    browsable        = models.BooleanField(default=True)
    rate             = models.IntegerField(default=0)
    publication_date = models.DateTimeField(default=datetime.now())
    
    def __unicode__(self):
        return "%s" % self.title