Skip to content

Commit 1045e1b

Browse files
committed
Add Meta class definition to HookForm
Meta class definition defines Hook model and well as fields. This is a requirement for ModelForm validation.
1 parent 229d79c commit 1045e1b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rest_hooks/admin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class HookForm(forms.ModelForm):
1717
"""
1818
ADMIN_EVENTS = [(x, x) for x in HOOK_EVENTS.keys()]
1919

20+
class Meta:
21+
model = Hook
22+
fields = ['user', 'target', 'event']
23+
2024
def __init__(self, *args, **kwargs):
2125
super(HookForm, self).__init__(*args, **kwargs)
2226
self.fields['event'] = forms.ChoiceField(choices=self.ADMIN_EVENTS)

0 commit comments

Comments
 (0)