1. class Platform(Model):
  2. """A list of all platforms we release to"""
  3. name = CharField(_('Name'), max_length=64)
  4. desc = CharField(_('Description'), max_length=255)
  5. parent = ForeignKey( 'self', verbose_name=_("Parent Platform"), **null)
  6. manager = ForeignKey( User, verbose_name=_("Platform Manager"), **null)
  7. icon = ResizedImageField(_('Icon (32x32)'), **upload_to('icons', 32, 32))
  8. image = ResizedImageField(_('Logo (256x256)'), **upload_to('icons', 256, 256))
  9. uuid = lambda self: slugify(self.name)
  10. tab_name = lambda self: self.name
  11. tab_text = lambda self: self.desc
  12. tab_cat = lambda self: {'icon': self.icon}
  13. root = lambda self: self.parent.root() if self.parent else self
  14. def __str__(self):
  15. if self.parent is not None and self.parent.parent is not None:
  16. return self.parent.parent.name + " " + self.parent.name + " " + self.name
  17. elif self.parent is not None:
  18. return self.parent.name + " "+ self.name
  19. else:
  20. return self.name
 
 

47

 

1114

Pasted Text #636

-

PasteBin

23
言葉
114
サイズ
1.1 KB
作成済み
タイプ
text/plain
Public Domain (PD)
コメントするにはログインしてください!