X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/3ab554e979a707490d303aaa690fde92c9c643c3..8e983105bb2635f3c90e7ddef54be5c36d814df1:/forum/forms.py diff --git a/forum/forms.py b/forum/forms.py index 9e931db..37c9b35 100644 --- a/forum/forms.py +++ b/forum/forms.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from django import forms from django.forms.models import ModelChoiceIterator from django.utils.translation import ugettext as _ @@ -15,7 +16,7 @@ class GroupedModelChoiceIterator(ModelChoiceIterator): def choice(self, obj): items_query = self.items_queryset.filter(**{self.field.grouping_fk_field: obj}) items = [super(GroupedModelChoiceIterator, self).choice(item) for item in items_query.all()] - return (unicode(obj), items) + return unicode(obj), items class GroupedModelChoiceField(forms.ModelChoiceField): @@ -35,5 +36,6 @@ class GroupedModelChoiceField(forms.ModelChoiceField): class PostForm(pybb.forms.PostForm): - lesson = GroupedModelChoiceField(label = _('Related lesson'), queryset = Lesson.objects.all(), - grouping_fk_field = 'section', required = False) + lesson = GroupedModelChoiceField( + label=_('Related lesson'), queryset=Lesson.objects.all(), + grouping_fk_field='section', required=False)