15 lines
426 B
Python
15 lines
426 B
Python
from django import forms
|
|
|
|
class PasswordSelectionForm(forms.Form):
|
|
password = forms.ChoiceField(
|
|
choices=[],
|
|
widget=forms.Select,
|
|
label="Select a password from the suggestions below"
|
|
)
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
passwords = kwargs.pop('passwords', [])
|
|
super().__init__(*args, **kwargs)
|
|
self.fields['password'].choices = [(pwd, pwd) for pwd in passwords]
|
|
|