From 297419f370ea87458017ee506a2e551e9068b66b Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Sun, 17 Nov 2013 19:15:30 +0200 Subject: Swicthing machines --- apps/docs/models.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'apps/docs') diff --git a/apps/docs/models.py b/apps/docs/models.py index bd95207..f95da57 100644 --- a/apps/docs/models.py +++ b/apps/docs/models.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django.db import models from django.template.defaultfilters import slugify @@ -11,17 +9,20 @@ class Image(models.Model): class Article(models.Model): slug = models.SlugField(editable=False) - title = models.CharField(max_length=255) - content = models.TextField() + title = models.CharField(max_length=255, default='New Article') + content = models.TextField(default='') published = models.BooleanField(default=True) created_at = models.DateTimeField(auto_now=True) updated_at = models.DateTimeField(auto_now=True) - images = models.ManyToManyField(Image, null=True) + images = models.ManyToManyField(Image, null=True, editable=False) def __unicode__(self): return self.title + def get_absolute_url(self): + return '/manage/docs/%d/' % self.pk + def save(self, *args, **kwargs): self.slug = slugify(self.title) super(Article, self).save(*args, **kwargs) -- cgit v1.2.3