From 53fab66f5b584d071b05f81da34ec136331ad143 Mon Sep 17 00:00:00 2001 From: Weitian LI Date: Fri, 25 Apr 2014 23:02:13 +0800 Subject: * deleted 'Notice.publisher' field * added 'blank=True' to 'NoticeAttachment.description' field * fixed attachment issue with 'list_notice.html' template --- notice/models.py | 3 +-- notice/templates/notice/list_notice.html | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/notice/models.py b/notice/models.py index 5fafeb5..02780ec 100644 --- a/notice/models.py +++ b/notice/models.py @@ -14,7 +14,6 @@ class Notice(models.Model): title = models.CharField(_("Title"), max_length=100) pubtime = models.DateTimeField(_("Publish time"), auto_now_add=True) category = models.ForeignKey('NoticeCategory', verbose_name=_("Category")) - publisher = models.ForeignKey(User, verbose_name=_("Publisher")) is_important = models.BooleanField(_("Is important"), default=False) contents = models.TextField(_("Contents")) # NoticeAttachment to deal with attachments @@ -50,7 +49,7 @@ class NoticeCategory(models.Model): class NoticeAttachment(models.Model): title = models.CharField(_("Title"), max_length=100) - description = models.TextField(_("Description")) + description = models.TextField(_("Description"), blank=True) attachment = models.FileField(upload_to='notice/attachments', verbose_name=_("Attachment")) content_type = models.ForeignKey(ContentType) diff --git a/notice/templates/notice/list_notice.html b/notice/templates/notice/list_notice.html index 2a2703b..14355f0 100644 --- a/notice/templates/notice/list_notice.html +++ b/notice/templates/notice/list_notice.html @@ -26,7 +26,7 @@
{{ notice.contents }}
- {% if notice.attachments %} + {% if notice.attachments.all %}