Added view to create source transformations, merged and normalized most source and source transformations views

This commit is contained in:
Roberto Rosario
2011-07-13 02:33:37 -04:00
parent d0da4daa93
commit 6fa40be524
6 changed files with 114 additions and 79 deletions

View File

@@ -55,8 +55,13 @@ SOURCE_CHOICE_WEB_FORM = 'webform'
SOURCE_CHOICE_STAGING = 'staging'
SOURCE_CHOICES = (
(SOURCE_CHOICE_WEB_FORM, _(u'Web form')),
(SOURCE_CHOICE_STAGING, _(u'Server staging folder')),
(SOURCE_CHOICE_WEB_FORM, _(u'web form')),
(SOURCE_CHOICE_STAGING, _(u'server staging folder')),
)
SOURCE_CHOICES_PLURAL = (
(SOURCE_CHOICE_WEB_FORM, _(u'web forms')),
(SOURCE_CHOICE_STAGING, _(u'server staging folders')),
)
@@ -70,6 +75,17 @@ class BaseModel(models.Model):
def __unicode__(self):
return u'%s' % self.title
def fullname(self):
return u' '.join([self.class_fullname(), '"%s"' % self.title])
@classmethod
def class_fullname(cls):
return unicode(dict(SOURCE_CHOICES).get(cls.source_type))
@classmethod
def class_fullname_plural(cls):
return unicode(dict(SOURCE_CHOICES_PLURAL).get(cls.source_type))
class Meta:
ordering = ('title',)
abstract = True