X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/bb2d8acdcc511aa33db185698bc9ad755f33d014..d0f0e1412cc42d366b234e798dfb68feed05d751:/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)