質問編集履歴

1

一部記載ミスにより編集しました

2019/06/05 04:49

投稿

kazu1125
kazu1125

スコア10

test CHANGED
File without changes
test CHANGED
@@ -58,19 +58,17 @@
58
58
 
59
59
 
60
60
 
61
- #Groupのチェックボックス作成
61
+ #Groupの選択メニューフォーム作成
62
62
 
63
- class GroupCheckForm(forms.Form):
63
+ class GroupSelectForm(forms.Form):
64
64
 
65
- def __int__(self, user, *args, **kwargs):
65
+ def __init__(self, user, *args, **kwargs):
66
66
 
67
- ・・・
67
+ super(GroupSelectForm, self).__init__(*args, **kwargs)
68
68
 
69
- self.fields["groups"] = forms.MultipleChoiceField(
69
+ self.fields["groups"] = forms.ChoiceField(
70
70
 
71
- choices = [(item.title, item.title) for item in Group.objects.filter(owner__in=[user, public])],
71
+ choices = [("-", "-")] + [(item.title, item.title) for item in Group.objects.filter(owner = user)],
72
-
73
- widget = forms.CheckboxSelectMultiple(),
74
72
 
75
73
  )
76
74