diff --git a/app/vkk/workhours/accounting/new_users/__init__.py b/app/vkk/workhours/accounting/new_users/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e2dc6f776d20ae77ccf692ab4f2160184dfc6053 100644 --- a/app/vkk/workhours/accounting/new_users/__init__.py +++ b/app/vkk/workhours/accounting/new_users/__init__.py @@ -0,0 +1,5 @@ +""" +This module contains the utilities associated with the management of new users. + +This module's substructure closely resembles the path substructure of the website. +""" \ No newline at end of file diff --git a/app/vkk/workhours/accounting/new_users/forms.py b/app/vkk/workhours/accounting/new_users/forms.py index 115fdaa177c2d17b7c77593231a132e74d95c4de..4045e72e1f2eb66f24a73cfd6f93cebd7bd1f7c8 100644 --- a/app/vkk/workhours/accounting/new_users/forms.py +++ b/app/vkk/workhours/accounting/new_users/forms.py @@ -1,15 +1,26 @@ +""" +A collection of forms used in this module. +""" + from django.forms import ModelForm from datetime import date, timedelta from vkk.generic.forms import CustomDateInput from vkk.users.models import NewUser, send_renew_mail class NewUserRenewForm(ModelForm): + """ + A class based `View` providing functionality for extending the expiration date for a + user to register. + """ class Meta: model = NewUser fields = ['expiration_date'] widgets = {'expiration_date' : CustomDateInput} def __init__(self, *args, **kwargs): + """ + Creates and returns a new object of this class. + """ if ( kwargs.get('initial') is None or kwargs['initial'].get('expiration_date') is None ): kwargs['initial'] = { @@ -18,5 +29,8 @@ class NewUserRenewForm(ModelForm): super().__init__(*args, **kwargs) def save(self, commit=True): + """ + Saves and returns a `NewUser` associated with this `Form` class object. + """ send_renew_mail(self.instance) return super().save(commit) diff --git a/app/vkk/workhours/accounting/new_users/urls.py b/app/vkk/workhours/accounting/new_users/urls.py index acf15934c7518638ae28ec2a2f86269d36e5573a..39f7943590946d01dacca127157b6fccf8db2a0e 100644 --- a/app/vkk/workhours/accounting/new_users/urls.py +++ b/app/vkk/workhours/accounting/new_users/urls.py @@ -1,3 +1,7 @@ +""" +This submodule contains the routing configuration. +""" + from django.urls import path from django.utils.translation import gettext_lazy as _ from vkk.workhours.accounting.views import AccountingFilterView, AccountingSuccessView, AccountingUpdateView diff --git a/app/vkk/workhours/accounting/salary-levels/__init__.py b/app/vkk/workhours/accounting/salary-levels/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..6fe7836332d5f32c0c17641cf663bd734efef485 100644 --- a/app/vkk/workhours/accounting/salary-levels/__init__.py +++ b/app/vkk/workhours/accounting/salary-levels/__init__.py @@ -0,0 +1,5 @@ +""" +This module contains the utilities associated with the management of salary levels. + +This module's substructure closely resembles the path substructure of the website. +""" \ No newline at end of file diff --git a/app/vkk/workhours/accounting/salary-levels/urls.py b/app/vkk/workhours/accounting/salary-levels/urls.py index d19a1a56c7060154cae52abfe1b14f2085fe412a..b718184809e25cbc08b560f111b8dfc3ef8b7d56 100644 --- a/app/vkk/workhours/accounting/salary-levels/urls.py +++ b/app/vkk/workhours/accounting/salary-levels/urls.py @@ -1,3 +1,7 @@ +""" +This submodule contains the routing configuration. +""" + from django.urls import path from django.utils.translation import gettext_lazy as _ from ..views import * diff --git a/app/vkk/workhours/accounting/users/__init__.py b/app/vkk/workhours/accounting/users/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0c8ad2e8ce2ac3f919680701d310530a78c313ca 100644 --- a/app/vkk/workhours/accounting/users/__init__.py +++ b/app/vkk/workhours/accounting/users/__init__.py @@ -0,0 +1,5 @@ +""" +This module contains the utilities associated with the management of users. + +This module's substructure closely resembles the path substructure of the website. +""" \ No newline at end of file diff --git a/app/vkk/workhours/accounting/users/urls.py b/app/vkk/workhours/accounting/users/urls.py index b908e722d619545fef0ca29b5ec5b3fd95e97617..95bdf8cb246d37abe7204fe43be77ba24b3a16e6 100644 --- a/app/vkk/workhours/accounting/users/urls.py +++ b/app/vkk/workhours/accounting/users/urls.py @@ -1,3 +1,7 @@ +""" +This submodule contains the routing configuration. +""" + from django.urls import path from django.utils.translation import gettext_lazy as _ from ..views import * @@ -64,4 +68,4 @@ urlpatterns = [ ), name='default' ), -] +] \ No newline at end of file diff --git a/app/vkk/workhours/accounting/users/views.py b/app/vkk/workhours/accounting/users/views.py index fe852deb815423d720b22c44d4550a7f55083bc3..45874dec0398f412be6c49a541f4561e6180696b 100644 --- a/app/vkk/workhours/accounting/users/views.py +++ b/app/vkk/workhours/accounting/users/views.py @@ -1,13 +1,23 @@ +""" +This submodule contains all fo the class based views of this module. +""" + from smtplib import SMTPException from vkk.workhours.accounting.views import AccountingCreateView, AccountingDetailView from vkk.users.models import User, NewUser, send_registration_mail from vkk.workhours.models import ProjectAssignment, ProjectManager class UserCreateView(AccountingCreateView): + """ + A class based view providing functionality for creating new `User`s. + """ model = User fields = ['first_name', 'last_name', 'email'] def form_valid(self, form): + """ + Saves the asscoated `Form` data and returns said instance. + """ user = form.instance user.set_unusable_password() response = super().form_valid(form) @@ -19,11 +29,17 @@ class UserCreateView(AccountingCreateView): return response class AccountingUserDetailView(AccountingDetailView): + """ + A class based `View` providing functionality for displaying a `User`s details. + """ template_name = 'vkk/workhours/accounting/users/details.html' model = User fields = ['first_name', 'last_name', 'email', 'last_login', 'is_accountant', 'is_active'] def get_context_data(self, **kwargs): + """ + Returns a context for rendering a page containg user details. + """ context = super().get_context_data(**kwargs) manages = ProjectManager.objects.filter( manager__pk=self.kwargs['pk']