script licenses list

This commit is contained in:
Sanj 2011-10-24 03:13:38 +01:00
parent f3c1d0dc8e
commit 56f3b54f6a

View File

@ -99,7 +99,7 @@ class Script(ItfModel):
class License(models.Model):
class License(ItfModel):
letter = models.CharField(max_length=2)
name = models.CharField(max_length=255)
short_description = models.TextField()
@ -107,9 +107,26 @@ class License(models.Model):
legal_file = models.FileField(upload_to='upload/licenses/legal/')
typ = models.CharField(choices=LICENSE_TYPE_CHOICES, max_length=32)
title_field = 'name'
def __unicode__(self):
return self.typ + ": " + self.letter + ": " + self.name
def list_dict(self):
return {
'id': self.id,
'title': self.name
}
def info_dict(self):
return {
'id': self.id,
'letter': self.letter,
'short_description': self.short_description,
'readable_file': self.readable_file.url,
'legal_file': self.legal_file.url,
'typ': self.typ
}
class Review(models.Model):
script = models.ForeignKey(Script)