Last active
May 10, 2017 02:35
-
-
Save hirokts/7953c8ffb046d7a17aeba87ff38f2b1d to your computer and use it in GitHub Desktop.
djangoでchoicefield(セレクトボックス)を含むformのformsetを使う場合の選択肢の注入のパターン(form)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArticleSelectForm(forms.Form): | |
title = forms.CharField( | |
widget=forms.TextInput(attrs={'placeholder': _(u'内容'), 'size': 60, }), | |
) | |
article_group = forms.ChoiceField( | |
widget=forms.Select(), | |
choices=[], | |
required=False, | |
) | |
ArticleSelectFormSet = formsets.formset_factory(ArticleSelectForm, extra=1, max_num=100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment