Source code for intranet.apps.itemreg.forms

from django import forms

from .models import CalculatorRegistration, ComputerRegistration, PhoneRegistration


[docs]class CalculatorRegistrationForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["calc_type"].label = "Calculator Type" self.fields["calc_serial"].label = "Calculator Serial" self.fields["calc_serial"].help_text = "Enter the calculator serial code (found engraved on the back of the calculator)" self.fields["calc_id"].label = "Calculator ID" self.fields["calc_id"].help_text = "Enter the calculator ID (without dashes)"
[docs] class Meta: model = CalculatorRegistration fields = ["calc_type", "calc_serial", "calc_id"]
[docs]class ComputerRegistrationForm(forms.ModelForm):
[docs] class Meta: model = ComputerRegistration fields = ["manufacturer", "model", "screen_size", "serial", "description"]
[docs]class PhoneRegistrationForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["imei"].label = "IMEI"
[docs] class Meta: model = PhoneRegistration fields = ["manufacturer", "model", "imei", "description"]