it/itf/insidepages/models.py
2011-08-23 03:34:40 +05:30

31 lines
805 B
Python

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)