2024-10-11 11:04:37 +00:00
|
|
|
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'),
|
2024-10-11 11:04:37 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
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
|