1. class Platform(Model):
  2. """A list of all platforms we release to"""
  3. parent = ForeignKey( 'self', verbose_name=_("Parent Platform"), **null)
  4. name = CharField(_('Name'), max_length=64)
  5. desc = CharField(_('Description'), max_length=255)
  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. el = self
  16. out = "";
  17. while el is not None:
  18. if out == "":
  19. out = el.name
  20. else:
  21. out = el.name + " " + out
  22. el = el.parent
  23. return out
 
 

41

 

1250

Pasted Text #637

-

PasteBin

Redci
26
Riječi
110
Veličina
1,0 KB
Stvoreno
Vrsta
text/plain
Public Domain (PD)
Prijavi se, ako želiš komentirati!