class Platform(Model):
"""A list of all platforms we release to"""
parent = ForeignKey( 'self', verbose_name=_("Parent Platform"), **null)
name = CharField(_('Name'), max_length=64)
desc = CharField(_('Description'), max_length=255)
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):
el = self
out = "";
while el is not None:
if out == "":
out = el.name
else:
out = el.name + " " + out
el = el.parent
return out
-
コメントするにはログインしてください!