#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of the Taler Codeless Merchant. # (C) 2018 GNUnet e.V. # # The Taler Codeless Merchant is free software: you can redistribute it and/or # modify it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # The Taler Codeless Merchant is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License # for more details. # # You should have received a copy of the GNU Affero General Public License along # with the Taler Codeless Merchant. If not, see . # # @author Shivam Kohli from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from inventory.models import Merchant, Product ADDRESS_CHOICES= [ ('', '---------'), ('sepa', 'SEPA'), ('upi', 'UPI'), ('bitcoin', 'BITCOIN'), ('ach', 'ACH'), ('other', 'OTHER'), ] class SignUpForm(UserCreationForm): first_name = forms.CharField(max_length=30, required=False) last_name = forms.CharField(max_length=30, required=False) email = forms.EmailField(max_length=254) website = forms.URLField(label='Enter website URL', max_length=250, required=False) address = forms.CharField(label='Payment Address type', widget=forms.Select(choices=ADDRESS_CHOICES)) pay_url = forms.URLField(label='Enter the Plain PaytoURI', max_length=250, required=False) account = forms.CharField(label='Account', max_length=30, required=False) class Meta: model = User fields = ( 'username', 'first_name', 'last_name', 'email', 'password1', 'password2', 'website', 'address', 'pay_url', 'account' ) def __init__(self, *args, **kwargs): super(SignUpForm, self).__init__(*args, **kwargs) for fieldname in ['username', 'password1', 'password2']: self.fields[fieldname].help_text = None class LoginForm(forms.ModelForm): password = forms.CharField(widget=forms.PasswordInput) class Meta: model = User fields = ( "username", "password" ) def __init__(self, *args, **kwargs): super(LoginForm, self).__init__(*args, **kwargs) for fieldname in ['username', 'password']: self.fields[fieldname].help_text = None class DocumentForm(forms.ModelForm): class Meta: model = Product fields = ('name', 'price', 'description', 'document', )