]> git.0d.be Git - django-panik-combo.git/blob - panikombo/models.py
96021a066ffada1ae2fd23a690470fcf02fd5b6a
[django-panik-combo.git] / panikombo / models.py
1 from django import template
2 from django.db import models
3 from django.utils.translation import ugettext_lazy as _
4
5 from combo.data.models import CellBase
6 from combo.data.library import register_cell_class
7
8 @register_cell_class
9 class SoundCell(CellBase):
10     soundfile = models.ForeignKey('emissions.SoundFile', null=True)
11
12     class Meta:
13         verbose_name = _('Sound')
14
15     def render(self, context):
16         tmpl = template.loader.get_template('panikombo/audio.html')
17         context['soundfile'] = self.soundfile
18         return tmpl.render(context)
19
20     def get_default_form_class(self):
21         from .forms import SoundCellForm
22         return SoundCellForm