aboutsummaryrefslogtreecommitdiffstats
path: root/apps/docs
diff options
context:
space:
mode:
Diffstat (limited to 'apps/docs')
-rw-r--r--apps/docs/models.py11
1 files changed, 6 insertions, 5 deletions
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)