vkk.workhours.manager.forms

A collection of Forms for project managers.

 1"""
 2A collection of `Form`s for project managers.
 3"""
 4
 5from django.forms import ModelForm, ModelChoiceField
 6from vkk.users.models import User
 7from vkk.workhours.models import SalaryLevel
 8
 9
10class ProjectRegisterContributorForm(ModelForm):
11    """
12    A `ModelForm` subclass for registering new `User`s.
13    """
14    class Meta():
15        """
16        Meta information for the `ProjectRegisterContributorForm` class.
17        """
18        model = User
19        fields = ['email', 'first_name', 'last_name']
20
21    salary_level = ModelChoiceField(
22        queryset=SalaryLevel.objects.all(),
23        required=True
24    )
25
26    def save(self, commit=True):
27        """
28        Saves the associated `User` instance to the database and returns it.
29        """
30        self.instance.set_unusable_password()
31        return super().save(commit)
class ProjectRegisterContributorForm(django.forms.models.ModelForm):
11class ProjectRegisterContributorForm(ModelForm):
12    """
13    A `ModelForm` subclass for registering new `User`s.
14    """
15    class Meta():
16        """
17        Meta information for the `ProjectRegisterContributorForm` class.
18        """
19        model = User
20        fields = ['email', 'first_name', 'last_name']
21
22    salary_level = ModelChoiceField(
23        queryset=SalaryLevel.objects.all(),
24        required=True
25    )
26
27    def save(self, commit=True):
28        """
29        Saves the associated `User` instance to the database and returns it.
30        """
31        self.instance.set_unusable_password()
32        return super().save(commit)

A ModelForm subclass for registering new Users.

def save(self, commit=True):
27    def save(self, commit=True):
28        """
29        Saves the associated `User` instance to the database and returns it.
30        """
31        self.instance.set_unusable_password()
32        return super().save(commit)

Saves the associated User instance to the database and returns it.

media

Return all media required to render the widgets on this form.

Inherited Members
django.forms.models.BaseModelForm
BaseModelForm
clean
validate_unique
django.forms.forms.BaseForm
order_fields
errors
is_valid
add_prefix
add_initial_prefix
get_context
non_field_errors
add_error
has_error
full_clean
has_changed
changed_data
is_multipart
hidden_fields
visible_fields
get_initial_for_field
django.forms.utils.RenderableFormMixin
as_p
as_table
as_ul
as_div
django.forms.utils.RenderableMixin
render
class ProjectRegisterContributorForm.Meta:
15    class Meta():
16        """
17        Meta information for the `ProjectRegisterContributorForm` class.
18        """
19        model = User
20        fields = ['email', 'first_name', 'last_name']

Meta information for the ProjectRegisterContributorForm class.