def __init__(self, request, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['comment'] = forms.CharField( label="", max_length=4000, required=True, widget=ckEditorWidget(request, toolbar='be_small', attrs={'style': 'height: 250px;'})) choices = [] for topic in fmod.Topic.objects.order_by('sort_order'): choices.append(( topic.id, mark_safe( '<div class="icon %s"></div><div class="topic_title">%s</div>' % (topic.icon, topic.title)))) if topic.title == request.urlparams[0]: self.initial['topic'] = topic.id self.fields['topic'] = forms.ChoiceField( label="Topic:", required=True, choices=choices, widget=lib.widgets.ButtonChoiceWidget()) if not self.initial.get('topic'): self.initial['topic'] = choices[2][0]
def __init__(self, request, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['comment'] = forms.CharField(label="", max_length=4000, required=True, widget=ckEditorWidget(request, toolbar='be_small', attrs={ 'style': 'height: 250px;' }))
def __init__(self, request, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['comment'] = forms.CharField(label="", max_length=4000, required=True, widget=ckEditorWidget(request, toolbar='be_small', attrs={ 'style': 'height: 250px;' })) choices = [] for topic in fmod.Topic.objects.order_by('sort_order'): choices.append(( topic.id, mark_safe('<div class="icon %s"></div><div class="topic_title">%s</div>' % (topic.icon, topic.title)) )) if topic.title == request.urlparams[0]: self.initial['topic'] = topic.id self.fields['topic'] = forms.ChoiceField(label="Topic:", required=True, choices=choices, widget=lib.widgets.ButtonChoiceWidget()) if not self.initial.get('topic'): self.initial['topic'] = choices[2][0]