Commit f754100262fb6c811baedbf076965ccf584e6a6e
1 parent
2491f076
Exists in
master
and in
2 other branches
Including create_date and creator fields
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
news/models.py
@@ -5,7 +5,7 @@ from autoslug.fields import AutoSlugField | @@ -5,7 +5,7 @@ from autoslug.fields import AutoSlugField | ||
5 | 5 | ||
6 | from django.utils.translation import ugettext_lazy as _ | 6 | from django.utils.translation import ugettext_lazy as _ |
7 | from django.core.exceptions import ValidationError | 7 | from django.core.exceptions import ValidationError |
8 | - | 8 | +from users.models import User |
9 | 9 | ||
10 | def validate_img_extension(value): | 10 | def validate_img_extension(value): |
11 | valid_formats = ['image/jpeg','image/x-citrix-jpeg','image/png','image/x-citrix-png','image/x-png'] | 11 | valid_formats = ['image/jpeg','image/x-citrix-jpeg','image/png','image/x-citrix-png','image/x-png'] |
@@ -19,6 +19,8 @@ class News(models.Model): | @@ -19,6 +19,8 @@ class News(models.Model): | ||
19 | slug = AutoSlugField(_("Slug"),populate_from='title',unique=True) | 19 | slug = AutoSlugField(_("Slug"),populate_from='title',unique=True) |
20 | image = models.ImageField(verbose_name = _('News Image'), upload_to = 'news/', validators = [validate_img_extension]) | 20 | image = models.ImageField(verbose_name = _('News Image'), upload_to = 'news/', validators = [validate_img_extension]) |
21 | content = models.TextField(_('News Content')) | 21 | content = models.TextField(_('News Content')) |
22 | + create_date = models.DateTimeField(_('Create Date'), auto_now_add = True) | ||
23 | + creator = models.ForeignKey(User, verbose_name = _('Creator'), related_name = "news_creator_user", null = True) | ||
22 | class Meta: | 24 | class Meta: |
23 | verbose_name = _('News') | 25 | verbose_name = _('News') |
24 | verbose_name_plural = _('News') | 26 | verbose_name_plural = _('News') |