devicehub-django/user/forms.py

21 lines
555 B
Python
Raw Permalink Normal View History

from django import forms
class SettingsForm(forms.Form):
token = forms.ChoiceField(
choices = []
)
erasure = forms.ChoiceField(
choices = [(0, 'Not erasure'),
2024-10-11 11:46:21 +00:00
('basic', 'Erasure Basic'),
('baseline', 'Erasure Baseline'),
('enhanced', 'Erasure Enhanced'),
],
)
def __init__(self, *args, **kwargs):
tokens = kwargs.pop('tokens')
super().__init__(*args, **kwargs)
tk = [(str(x.token), x.tag) for x in tokens]
self.fields['token'].choices = tk