Commit f754100262fb6c811baedbf076965ccf584e6a6e

Authored by Gustavo
1 parent 2491f076

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 5  
6 6 from django.utils.translation import ugettext_lazy as _
7 7 from django.core.exceptions import ValidationError
8   -
  8 +from users.models import User
9 9  
10 10 def validate_img_extension(value):
11 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 19 slug = AutoSlugField(_("Slug"),populate_from='title',unique=True)
20 20 image = models.ImageField(verbose_name = _('News Image'), upload_to = 'news/', validators = [validate_img_extension])
21 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 24 class Meta:
23 25 verbose_name = _('News')
24 26 verbose_name_plural = _('News')
... ...