From 7b49bcc4bc70e4fdb87c980d72d63fbacb47ba9e Mon Sep 17 00:00:00 2001 From: bkfox Date: Sun, 22 May 2016 18:15:26 +0200 Subject: [PATCH] check --- README.md | 2 +- cms/models.py | 47 ++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3c722c2..5a62d76 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/cms/models.py b/cms/models.py index 33e538b..9f803f1 100644 --- a/cms/models.py +++ b/cms/models.py @@ -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 + ) + + +