from django conf import settings from django db import models from dja

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from django.conf import settings
from django.db import models
from django.utils.encoding import smart_unicode
import mptt
class Category(models.Model):
slug = models.CharField(max_length=255)
title = models.CharField(max_length=255)
links = models.PositiveIntegerField(default=0)
meta_title = models.CharField(max_length=255)
meta_keywords = models.CharField(max_length=255)
parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
class Admin:
list_display = ('title', 'links')
class Meta:
ordering = ['title']
def __unicode__(self):
return smart_unicode(self.title)
mptt.register(Category, order_insertion_by='title')