1 # -*- coding: utf-8 -*-
2 from django.db import models
3 from django.utils.translation import ugettext_lazy as _
7 class Document(models.Model):
8 """Dokument - materiaĆ pomocniczy dla nauczycieli."""
9 title = models.CharField(_('title'), max_length=120)
10 slug = models.SlugField(_('slug'))
11 file = models.FileField(_('file'), upload_to='lessons/document')
12 author = models.CharField(_('author'), blank=True, max_length=120)
13 slideshare_id = models.CharField(_('slideshare ID'), blank=True, max_length=120)
14 description = models.TextField(_('description'), blank=True)
15 created_at = models.DateTimeField(auto_now_add=True)
17 def slideshare_player(self):
18 base, ext = path.splitext(self.file.name)
19 if ext in ('.ppt', '.pps', '.pot', '.pptx', '.potx', '.ppsx', '.odp', '.key', '.zip', '.pdf',):
20 return 'ssplayer2.swf'
22 return 'ssplayerd.swf'
26 verbose_name, verbose_name_plural = _("document"), _("documents")
28 def __unicode__(self):
32 def get_absolute_url(self):
33 return ('lessons_document_detail', [self.slug])