class Platform(Model):
"""A list of all platforms we release to"""
name = CharField(_('Name'), max_length=64)
desc = CharField(_('Description'), max_length=255)
parent = ForeignKey( 'self', verbose_name=_("Parent Platform"), **null)
manager = ForeignKey( User, verbose_name=_("Platform Manager"), **null)
icon = ResizedImageField(_('Icon (32x32)'), **upload_to('icons', 32, 32))
image = ResizedImageField(_('Logo (256x256)'), **upload_to('icons', 256, 256))
uuid = lambda self: slugify(self.name)
tab_name = lambda self: self.name
tab_text = lambda self: self.desc
tab_cat = lambda self: {'icon': self.icon}
root = lambda self: self.parent.root() if self.parent else self
def __str__(self):
if self.parent is not None and self.parent.parent is not None:
return self.parent.parent.name + " " + self.parent.name + " " + self.name
elif self.parent is not None:
return self.parent.name + " "+ self.name
else:
return self.name
-
Per favore accedi per lasciare un commento!