diff options
author | luxagraf <sng@luxagraf.net> | 2020-11-15 10:13:08 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2020-11-15 10:13:08 -0500 |
commit | 7509da286bccd1dda358507cd455f9297db59247 (patch) | |
tree | 779aa3660e453d73268d22a72d9a5599cc94aa02 /app/publications/models.py | |
parent | b2434dcba142961b4a4b67780cf64e01d0908bf5 (diff) |
ported jrnl building to posts
Diffstat (limited to 'app/publications/models.py')
-rw-r--r-- | app/publications/models.py | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/app/publications/models.py b/app/publications/models.py deleted file mode 100644 index 05f7267..0000000 --- a/app/publications/models.py +++ /dev/null @@ -1,133 +0,0 @@ -from django.contrib.gis.db import models -from django.utils import timezone -from django.utils.text import slugify -from django.urls import reverse - -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') - PUB_STATUS = ( - (0, 'Not Published'), - (1, 'Published'), - ) - status = models.IntegerField(choices=PUB_STATUS, default=0) - date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) - date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) - pays = models.BooleanField(default=True) - pays_amount = models.CharField(max_length=100, blank=True) - submission_period_start = models.DateField(blank=True, null=True) - submission_period_end = models.DateField(blank=True, null=True) - - class Meta: - ordering = ('-name', '-date_created') - - def __str__(self): - return self.name - - def get_absolute_url(self): - return reverse("publications:pub-detail", kwargs={"slug": self.slug}) - - def save(self, *args, **kwargs): - if not self.id: - self.date_created = timezone.now() - self.date_updated = timezone.now() - super(Publication, self).save() - - -class Editor(models.Model): - first_name = models.CharField(max_length=250) - last_name = models.CharField(max_length=250) - email = models.CharField(max_length=250, blank=True) - phone = models.CharField(max_length=250, blank=True) - twitter = models.CharField(max_length=250, blank=True) - slug = models.SlugField(blank=True) - notes = models.TextField(blank=True) - publication = models.ForeignKey(Publication, on_delete=models.SET_NULL, blank=True, null=True) - section = models.ManyToManyField(Section, 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) - - class Meta: - ordering = ('-last_name', '-date_created') - - def __str__(self): - return "{0} {1}".format(self.first_name, self.last_name) - - def get_absolute_url(self): - return reverse("publications:pub-detail", kwargs={"slug": self.slug}) - - def save(self, *args, **kwargs): - if self._state.adding: - self.slug = slugify('%s %s' % (self.first_name, self.last_name))[:50] - self.date_created = timezone.now() - self.date_updated = timezone.now() - super(Editor, self).save() - - -class Pitch(models.Model): - title = models.CharField(max_length=250) - pitch = models.TextField() - slug = models.SlugField(blank=True) - editor = models.ForeignKey(Editor, on_delete=models.SET_NULL, blank=True, null=True) - accepted = models.BooleanField(null=True, blank=True) - date_sent = models.DateTimeField(blank=True, null=True) - date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) - date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) - - class Meta: - ordering = ('-title', '-date_sent') - - def __str__(self): - return self.title - - def save(self, *args, **kwargs): - if self._state.adding: - self.slug = slugify(self.title)[:50] - self.date_created = timezone.now() - self.date_updated = timezone.now() - super(Pitch, self).save() - - -class PitchIdea(models.Model): - title = models.CharField(max_length=250) - pitch = models.TextField() - publication = models.ForeignKey(Publication, on_delete=models.SET_NULL, blank=True, null=True) - date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) - date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) - - class Meta: - ordering = ('-title', '-date_created') - - def __str__(self): - return self.title - - def save(self, *args, **kwargs): - if self._state.adding: - self.date_created = timezone.now() - self.date_updated = timezone.now() - super(PitchIdea, self).save() |