summaryrefslogtreecommitdiff
path: root/app/publications/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/publications/models.py')
-rw-r--r--app/publications/models.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/app/publications/models.py b/app/publications/models.py
index d47d5f6..a7f0c1a 100644
--- a/app/publications/models.py
+++ b/app/publications/models.py
@@ -8,8 +8,26 @@ from taggit.managers import TaggableManager
from taxonomy.models import TaggedItems
+class Section(models.Model):
+ """ Generic model for Categories """
+ name = models.CharField(max_length=250)
+ slug = models.SlugField(blank=True)
+ date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False)
+ date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False)
+
+ def __str__(self):
+ return self.name
+
+ def save(self, *args, **kwargs):
+ if self._state.adding:
+ self.slug = slugify(self.name)[:50]
+ super(Section, self).save()
+
+
class Publication(models.Model):
name = models.CharField(max_length=250)
+ url = models.CharField(max_length=250, blank=True)
+ section = models.ManyToManyField(Section, blank=True)
slug = models.SlugField(unique_for_date='pub_date', blank=True)
notes = models.TextField(blank=True)
tags = TaggableManager(through=TaggedItems, blank=True, help_text='Topics Covered')
@@ -37,22 +55,6 @@ class Publication(models.Model):
super(Publication, self).save()
-class Section(models.Model):
- """ Generic model for Categories """
- name = models.CharField(max_length=250)
- slug = models.SlugField(blank=True)
- date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False)
- date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False)
-
- def __str__(self):
- return self.name
-
- def save(self, *args, **kwargs):
- if self._state.adding:
- self.slug = slugify(self.name)[:50]
- super(Section, self).save()
-
-
class Editor(models.Model):
first_name = models.CharField(max_length=250)
last_name = models.CharField(max_length=250)