from django.db import models
from django.conf import settings
+from django.contrib import admin
FORMAT_CHOICES = (
('rst', 'reStructuredText'),
)
class BlogEntry(models.Model):
- title = models.CharField(maxlength=150)
+ title = models.CharField(max_length=150)
islive = models.BooleanField()
sections = models.ManyToManyField('BlogSection')
- format = models.CharField(maxlength=10, choices=FORMAT_CHOICES)
- slug = models.SlugField(prepopulate_from=("title",))
+ format = models.CharField(max_length=10, choices=FORMAT_CHOICES)
+ slug = models.SlugField()
publish_date = models.DateTimeField()
content = models.TextField()
class Meta:
ordering = ['-publish_date']
- class Admin:
- pass
-
class BlogSection(models.Model):
- title = models.CharField(maxlength=150)
- slug = models.SlugField(prepopulate_from=("title",))
+ title = models.CharField(max_length=150)
+ slug = models.SlugField()
def __str__(self):
return self.__unicode__()
def get_absolute_url(self):
return u'%ssection/%s/' %(settings.BLOG_ROOT, self.slug)
-
- class Admin:
- pass