Skip to content
Snippets Groups Projects
Select Git revision
  • 59019c8371e3b234c730e400f0039e4d3d69e41f
  • main default protected
  • renovate/django-debug-toolbar-6.x
  • renovate/jsonschema-4.x
  • renovate/django-5.x
  • koma/feature/preference-polling-form
6 results

forms.py

Blame
  • Benjamin Hättasch's avatar
    Benjamin Hättasch authored
    Add or complete docstrings
    Remove code smells
    Disable irrelevant warnings
    Remove empty admin.py (to disable doc generation for an empty module)
    Add additional test cases and improve basic test interface (support both 403 and 302 in case the user lacks rights to see a view through optional configuration)
    Improve usage of types for API endpoints (e.g., restrict writing endpoints to writing only)
    63c18d2e
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    forms.py 907 B
    from django import forms
    from django.utils.translation import gettext_lazy as _
    
    from AKModel.models import AK
    
    
    class AKInterestForm(forms.ModelForm):
        """
        Form for quickly changing the interest count and notes of an AK
        """
        required_css_class = 'required'
    
        class Meta:
            model = AK
            fields = ['interest',
                      'notes',
                      ]
    
    
    class AKAddSlotForm(forms.Form):
        """
        Form to create a new slot for an existing AK directly from scheduling view
        """
        start = forms.CharField(label=_("Start"), disabled=True)
        end = forms.CharField(label=_("End"), disabled=True)
        duration = forms.CharField(label=_("Duration"), disabled=True)
        room = forms.IntegerField(label=_("Room"), disabled=True)
    
        def __init__(self, event):
            super().__init__()
            self.fields['ak'] = forms.ModelChoiceField(event.ak_set.all(), label=_("AK"))