Commit 0cf13fcd080bf7cad2ce5fa674273750f9a2c2d1

Authored by ailsoncgt
1 parent 1d055369

ordering option in model #127

Showing 1 changed file with 3 additions and 2 deletions   Show diff stats
files/models.py
1 from django.db import models 1 from django.db import models
2 from django.utils.translation import ugettext_lazy as _ 2 from django.utils.translation import ugettext_lazy as _
3 -from core.models import MymeType 3 +from core.models import MimeType
4 from courses.models import Material 4 from courses.models import Material
5 5
6 """ 6 """
@@ -17,12 +17,13 @@ def file_path(instance, filename): @@ -17,12 +17,13 @@ def file_path(instance, filename):
17 class TopicFile(Material): 17 class TopicFile(Material):
18 description = models.TextField(_('Description'), blank=True) 18 description = models.TextField(_('Description'), blank=True)
19 file_url = models.FileField(verbose_name = _("File"), upload_to = file_path) 19 file_url = models.FileField(verbose_name = _("File"), upload_to = file_path)
20 - file_type = models.ForeignKey(MymeType, verbose_name=_('Type file'), related_name='topic_files') 20 + file_type = models.ForeignKey(MimeType, verbose_name=_('Type file'), related_name='topic_files')
21 21
22 22
23 class Meta: 23 class Meta:
24 verbose_name = _("File") 24 verbose_name = _("File")
25 verbose_name_plural = _("Files") 25 verbose_name_plural = _("Files")
  26 + ordering = ('-id')
26 27
27 def __str__(self): 28 def __str__(self):
28 return self.name 29 return self.name
29 \ No newline at end of file 30 \ No newline at end of file