1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

35 lines
955 B
Python
Raw Normal View History

2017-03-08 11:34:47 -05:00
from django import forms
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm as DjangoPasswordChangeForm
2016-03-01 11:23:03 -05:00
2019-12-28 22:55:00 +00:00
from utilities.forms import BootstrapMixin, DateTimePicker
2017-03-08 11:34:47 -05:00
from .models import Token
2016-03-01 11:23:03 -05:00
class LoginForm(BootstrapMixin, AuthenticationForm):
2016-03-01 11:23:03 -05:00
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
2016-03-01 11:23:03 -05:00
self.fields['username'].widget.attrs['placeholder'] = ''
self.fields['password'].widget.attrs['placeholder'] = ''
class PasswordChangeForm(BootstrapMixin, DjangoPasswordChangeForm):
2016-03-01 11:23:03 -05:00
pass
2017-03-08 11:34:47 -05:00
class TokenForm(BootstrapMixin, forms.ModelForm):
2018-11-27 11:57:29 -05:00
key = forms.CharField(
required=False,
help_text="If no key is provided, one will be generated automatically."
)
2017-03-08 11:34:47 -05:00
class Meta:
model = Token
2018-11-27 11:57:29 -05:00
fields = [
'key', 'write_enabled', 'expires', 'description',
]
2019-12-28 22:55:00 +00:00
widgets = {
'expires': DateTimePicker(),
2017-03-08 11:34:47 -05:00
}