from django.db import models from django.contrib.contenttypes.models import ContentType class Module(models.Model): title = models.CharField(max_length=255) slug = models.SlugField() def __unicode__(self): return self.title def get_absolute_url(self): return "/m/" + self.slug class ModuleTab(models.Model): module = models.ForeignKey(Module) title = models.CharField(max_length=64) text = models.TextField() model = models.ForeignKey(ContentType) is_default = models.BooleanField(default=False) order = models.IntegerField(default=1) is_displayed = models.BooleanField(default=True) def __unicode__(self): return self.title def get_list(self, options): return self.model.model_class().get_list(options)