class Meta: model = Shop fields = [ 'pushover_user_key', 'pushover_device_name', ] labels = { 'pushover_user_key': _('User Key in Pushover App Settings'), 'pushover_device_name': _('Device Name in Pushover App Settings'), } icons = { 'pushover_user_key': Icon('key'), 'pushover_device_name': Icon('tablet-alt'), }
class UserLoginForm(AuthenticationForm): username = UsernameField(widget=forms.TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Логин' }), label=Icon('user', 'far').as_html()) password = forms.CharField( label=Icon('key', 'fas').as_html(), widget=forms.PasswordInput(attrs={ 'class': 'form-control', 'placeholder': 'Пароль' })) ReCaptcha = ReCaptchaField( ReCaptchaWidget(), label='', error_messages={'required': 'Каптча не пройдена!'})
class Meta: model = Shop fields = [ 'slug', 'facebook_href', 'instagram_href', 'google_maps_href', 'trip_advisor_href' ] labels = { 'slug': _('Pop Handle'), 'facebook_href': _('Facebook Profile Link'), 'instagram_href': _('Instagram Profile Link'), 'google_maps_href': _('Google Maps Profile Link'), 'trip_advisor_href': _('TripAdvisor Profile Link'), } icons = { 'slug': Icon('at'), 'facebook_href': Icon('facebook', 'fab'), 'instagram_href': Icon('instagram', 'fab'), 'google_maps_href': Icon('map-marker'), 'trip_advisor_href': Icon('tripadvisor', 'fab') }
class Meta: model = Shop fields = [ 'name', 'description', 'base_language' ] labels = { 'name': _('Name'), 'description': _('About'), 'base_language': _('First Language') } icons = { 'name': Icon('store'), } required_fields = ['name', ]
class UserProfileForm(UserChangeForm): password = None username = UsernameField( widget=forms.TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Логин', 'readonly': True }), label=Icon('user', 'far').as_html()) ReCaptcha = ReCaptchaField( ReCaptchaWidget(), label='', error_messages={'required': 'Каптча не пройдена!'}) class Meta: model = RExamUserModel fields = ('username', 'email', 'last_name', 'first_name', 'middle_name', 'study_group', 'ReCaptcha') widgets = { 'first_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Имя' }), 'last_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Фамилия' }), 'middle_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Отчество', }), 'study_group': Select(attrs={ 'class': 'form-control', 'placeholder': 'Группа' }), 'email': EmailInput(attrs={ 'class': 'form-control', 'placeholder': 'E-Mail' }), } labels = { 'first_name': Icon('address-card', 'far').as_html(), 'last_name': Icon('address-card', 'far').as_html(), 'middle_name': Icon('address-card', 'far').as_html(), 'study_group': Icon('users', 'fas').as_html(), 'email': Icon('envelope', 'far').as_html(), }
class Meta(UserCreationForm.Meta): model = RExamUserModel fields = ('username', 'email', 'password1', 'password2', 'last_name', 'first_name', 'middle_name', 'study_group') widgets = { 'first_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Имя' }), 'last_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Фамилия' }), 'middle_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Отчество' }), 'study_group': Select(attrs={ 'class': 'form-control', 'placeholder': 'Группа' }), 'email': EmailInput(attrs={ 'class': 'form-control', 'placeholder': 'E-Mail' }), } labels = { 'first_name': Icon('address-card', 'far').as_html(), 'last_name': Icon('address-card', 'far').as_html(), 'middle_name': Icon('address-card', 'far').as_html(), 'study_group': Icon('users', 'fas').as_html(), 'email': Icon('envelope', 'far').as_html(), }
class ChangePasswordForm(PasswordChangeForm): ReCaptcha = ReCaptchaField( ReCaptchaWidget(), label='', error_messages={'required': 'Каптча не пройдена!'}) new_password1 = forms.CharField( label=Icon('key', 'fas').as_html(), widget=forms.PasswordInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите новый пароль' })) new_password2 = forms.CharField( label=Icon('key', 'fas').as_html(), widget=forms.PasswordInput(attrs={ 'class': 'form-control', 'placeholder': 'Повторите новый пароль' })) old_password = forms.CharField( label=Icon('key', 'fas').as_html(), widget=forms.PasswordInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите старый пароль' }))
class UserCreateForm(UserCreationForm): ReCaptcha = ReCaptchaField( ReCaptchaWidget(), label='', error_messages={'required': 'Каптча не пройдена!'}) password1 = forms.CharField( label=Icon('key', 'fas').as_html(), widget=forms.PasswordInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите пароль' })) password2 = forms.CharField( label=Icon('key', 'fas').as_html(), widget=forms.PasswordInput(attrs={ 'class': 'form-control', 'placeholder': 'Повторите пароль' })) username = forms.RegexField( label=Icon('user', 'far').as_html(), max_length=30, regex=r'[a-zA-Z0-9]+', error_messages={'invalid': 'Только латинские символы и цифры!'}, widget=TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Логин' })) class Meta(UserCreationForm.Meta): model = RExamUserModel fields = ('username', 'email', 'password1', 'password2', 'last_name', 'first_name', 'middle_name', 'study_group') widgets = { 'first_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Имя' }), 'last_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Фамилия' }), 'middle_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Отчество' }), 'study_group': Select(attrs={ 'class': 'form-control', 'placeholder': 'Группа' }), 'email': EmailInput(attrs={ 'class': 'form-control', 'placeholder': 'E-Mail' }), } labels = { 'first_name': Icon('address-card', 'far').as_html(), 'last_name': Icon('address-card', 'far').as_html(), 'middle_name': Icon('address-card', 'far').as_html(), 'study_group': Icon('users', 'fas').as_html(), 'email': Icon('envelope', 'far').as_html(), }