Debian Codegraph @

src/organizations/backends/forms.py

raw symbols SCIP
1
2 from django import forms
3 from django.contrib.auth.forms import UserCreationForm
4
5
6 class UserRegistrationForm(UserCreationForm):
7 """
8 Form class for completing a user's registration and activating the
9 User.
10
11 The class operates on a user model which is assumed to have the required
12 fields of a BaseUserModel
13 """
14
15 # TODO(bennylope): Remove this entirely and replace with base class
16
17
18 def org_registration_form(org_model):
19 """
20 Generates a registration ModelForm for the given organization model class
21 """
22
23 class OrganizationRegistrationForm(forms.ModelForm):
24 """Form class for creating new organizations owned by new users."""
25
26 email = forms.EmailField()
27
28 class Meta:
29 model = org_model
30 exclude = ("is_active", "users")
31
32 # def save(self, *args, **kwargs):
33 # self.instance.is_active = False
34 # super().save(*args, **kwargs)
35
36 return OrganizationRegistrationForm