Commit 0cf13fcd080bf7cad2ce5fa674273750f9a2c2d1
1 parent
1d055369
Exists in
master
and in
5 other branches
ordering option in model #127
Showing
1 changed file
with
3 additions
and
2 deletions
Show diff stats
files/models.py
| 1 | 1 | from django.db import models |
| 2 | 2 | from django.utils.translation import ugettext_lazy as _ |
| 3 | -from core.models import MymeType | |
| 3 | +from core.models import MimeType | |
| 4 | 4 | from courses.models import Material |
| 5 | 5 | |
| 6 | 6 | """ |
| ... | ... | @@ -17,12 +17,13 @@ def file_path(instance, filename): |
| 17 | 17 | class TopicFile(Material): |
| 18 | 18 | description = models.TextField(_('Description'), blank=True) |
| 19 | 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 | 23 | class Meta: |
| 24 | 24 | verbose_name = _("File") |
| 25 | 25 | verbose_name_plural = _("Files") |
| 26 | + ordering = ('-id') | |
| 26 | 27 | |
| 27 | 28 | def __str__(self): |
| 28 | 29 | return self.name |
| 29 | 30 | \ No newline at end of file | ... | ... |