This commit is contained in:
bkfox 2016-05-22 18:15:26 +02:00
parent 67c83c65d1
commit 7b49bcc4bc
2 changed files with 43 additions and 6 deletions

View File

@ -1,4 +1,4 @@
![](/data/logo.png =400x)
![](/data/logo.png)
Platform to manage a radio, schedules, website, and so on. We use the power of Django and Liquidsoap.

View File

@ -18,6 +18,7 @@ class Post (models.Model):
Base model that can be used as is if wanted. Represent a generic
publication on the website.
"""
# metadata
thread_type = models.ForeignKey(
ContentType,
on_delete=models.SET_NULL,
@ -28,6 +29,16 @@ class Post (models.Model):
)
thread = GenericForeignKey('thread_type', 'thread_pk')
published = models.BooleanField(
verbose_name = _('public'),
default = True
)
allow_comments = models.BooleanField(
verbose_name = _('allow comments'),
default = True,
)
# content
author = models.ForeignKey(
User,
verbose_name = _('author'),
@ -37,11 +48,6 @@ class Post (models.Model):
_('date'),
default = timezone.datetime.now
)
published = models.BooleanField(
verbose_name = _('public'),
default = True
)
title = models.CharField (
_('title'),
max_length = 128,
@ -58,6 +64,7 @@ class Post (models.Model):
blank = True,
)
def detail_url (self):
return reverse(self._meta.verbose_name.lower() + '_detail',
kwargs = { 'pk': self.pk,
@ -316,3 +323,33 @@ class RelatedPost (Post, metaclass = RelatedPostBase):
super().save(*args, **kwargs)
class Comment(models.Model):
thread_type = models.ForeignKey(
ContentType,
on_delete=models.SET_NULL,
blank = True, null = True
)
thread_pk = models.PositiveIntegerField(
blank = True, null = True
)
thread = GenericForeignKey('thread_type', 'thread_pk')
author = models.TextField(
verbose_name = _('author'),
blank = True, null = True,
)
email = models.EmailField(
verbose_name = _('email'),
blank = True, null = True,
)
date = models.DateTimeField(
_('date'),
default = timezone.datetime.now
)
content = models.TextField (
_('description'),
blank = True, null = True
)