X-Git-Url: https://git.sommitrealweird.co.uk/sommitrealweird.git/blobdiff_plain/92bdd2925f6401b3d5447731424f1e11a5c4643e..525b287d2a1c652749f6e175568695907ac3a65b:/sommitrealweird/blog/models.py?ds=inline diff --git a/sommitrealweird/blog/models.py b/sommitrealweird/blog/models.py index 7573674..9548a32 100644 --- a/sommitrealweird/blog/models.py +++ b/sommitrealweird/blog/models.py @@ -1,5 +1,6 @@ from django.db import models from django.conf import settings +from django.contrib import admin FORMAT_CHOICES = ( ('rst', 'reStructuredText'), @@ -7,11 +8,11 @@ FORMAT_CHOICES = ( ) class BlogEntry(models.Model): - title = models.CharField(maxlength=150) - islive = models.BooleanField() + title = models.CharField(max_length=150) + islive = models.BooleanField(default=False) 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() @@ -27,12 +28,9 @@ class BlogEntry(models.Model): 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__() @@ -42,6 +40,3 @@ class BlogSection(models.Model): def get_absolute_url(self): return u'%ssection/%s/' %(settings.BLOG_ROOT, self.slug) - - class Admin: - pass