Example #1
0
 class Meta:
     model = Autor
     fields = ('nombre', 'apellido')
     widgets = {
         'nombre': forms.TextInput(attrs={'class': 'form-control'}),
         'apellido': forms.TextInput(attrs={'class': 'form-control'}),
     }
Example #2
0
class ShippingForm(forms.ModelForm):
    email = forms.CharField(widget=forms.EmailInput(attrs={
        "placeholder": "Email..",
    }))

    address = forms.CharField(widget=forms.TextInput(
        attrs={
            "placeholder": "Address..",
            "id": "address",
            "name": "address"
        }))
    city = forms.CharField(widget=forms.TextInput(attrs={
        "placeholder": "City..",
        "id": "city"
    }))
    state = forms.CharField(widget=forms.TextInput(attrs={
        "placeholder": "State..",
        "id": "state"
    }))
    zip_code1 = forms.IntegerField(widget=forms.NumberInput(attrs={
        "placeholder": "Zip Code..",
        "id": "zip"
    }))
    zip_code2 = forms.IntegerField(widget=forms.NumberInput(attrs={
        "placeholder": "Zip Code..",
        "id": "zip2"
    }))

    class Meta:
        model = ShippingAddress
        fields = [
            "email", "address", "city", "state", "zip_code1", "zip_code2"
        ]
Example #3
0
class SignUpForm(UserCreationForm):
    first_name = forms.CharField(
        max_length=12,
        min_length=4,
        required=True,
        help_text='Required: First Name',
        widget=forms.TextInput(attrs={
            'class': 'form-control',
            'placeholder': 'First Name'
        }))
    last_name = forms.CharField(
        max_length=12,
        min_length=4,
        required=True,
        help_text='Required: Last Name',
        widget=(forms.TextInput(attrs={'class': 'form-control'})))
    email = forms.EmailField(
        max_length=50,
        help_text='Required. Inform a valid email address.',
        widget=forms.EmailInput(attrs={'placeholder': 'Email'}),
    )
    password1 = forms.CharField(
        label=_('Password'),
        widget=(forms.PasswordInput(attrs={
            'placeholder': 'Password',
        })),
        help_text=password_validation.password_validators_help_text_html())
    password2 = forms.CharField(
        label=_('Password Confirmation'),
        widget=forms.PasswordInput(
            attrs={'placeholder': 'Password Confirmation'}),
        help_text=_('Just Enter the same password, for confirmation'))
    username = forms.CharField(
        label=_('Username'),
        max_length=150,
        help_text=
        _('Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.'
          ),
        validators=[username_validator],
        error_messages={
            'unique': _("A user with that username already exists.")
        },
        widget=forms.TextInput(attrs={'placeholder': 'Username'}))

    class Meta:
        model = User
        fields = (
            'username',
            'first_name',
            'last_name',
            'email',
            'password1',
            'password2',
        )
Example #4
0
    class Meta:
        model = MyUser
        fields = ['user_name', 'email', 'first_name', 'last_name',  'airport']
        labels = {'email': 'Email', 'first_name': 'First Name',
                  'last_name': 'Last Name'}

        widgets = {'user_name': forms.TextInput(attrs={'class': 'form-control'}),
                   'email': forms.EmailInput(attrs={'class': 'form-control'}),
                   'first_name': forms.TextInput(attrs={'class': 'form-control'}),
                   'last_name': forms.TextInput(attrs={'class': 'form-control'}),
                   'airport': forms.Select(attrs={'class': 'form-control'}),
                   }
Example #5
0
    class Meta:
        model = MyUser
        fields = ['user_name', 'first_name', 'last_name',
                  'email', 'phone', 'address', 'image']
        labels = {'email': 'Email', 'first_name': 'First Name',
                  'last_name': 'Last Name'}

        widgets = {'user_name': forms.TextInput(attrs={'class': 'form-control'}),
                   'first_name': forms.TextInput(attrs={'class': 'form-control'}),
                   'last_name': forms.TextInput(attrs={'class': 'form-control'}),
                   'email': forms.EmailInput(attrs={'class': 'form-control'}),
                   'phone': forms.TextInput(attrs={'class': 'form-control'}),
                   'address': forms.TextInput(attrs={'class': 'form-control'}),
                   }
Example #6
0
    class Meta:
        model = Noticia
        fields = ('titulo', 'fecha', 'campo', 'alcance', 'autor', 'revista', 'resumen', 'weblink')

        widgets = {
            'titulo': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'nombre del articulo'}),
            'fecha': forms.DateTimeInput(attrs={'class': 'form-control', 'placeholder': 'AÑO-MES-DIA'}),
            'campo': forms.Select(attrs={'class': 'form-control'}),
            'alcance': forms.Select(attrs={'class': 'form-control'}),
            'autor': forms.SelectMultiple(attrs={'class': 'form-control'}),
            'revista': forms.SelectMultiple(attrs={'class': 'form-control'}),
            'resumen': forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'breve descripcion del articulo'}),
            'weblink': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'enlace para acceder al articulo'}),
        }
Example #7
0
class CustomInfo(UserCreationForm):
    email = forms.EmailField(
        max_length=50,
        help_text='Required. Inform a valid email address.',
        widget=forms.EmailInput(attrs={
            'placeholder': 'Email',
            "class": "inpt",
        }),
    )
    password1 = forms.CharField(
        label=_('Password'),
        widget=(forms.PasswordInput(attrs={
            'placeholder': 'Password',
        })),
        help_text=password_validation.password_validators_help_text_html())
    password2 = forms.CharField(
        label=_('Password Confirmation'),
        widget=forms.PasswordInput(
            attrs={'placeholder': 'Password Confirmation'}),
        help_text=_('Just Enter the same password, for confirmation'))
    username = forms.CharField(
        label=_('Username'),
        max_length=150,
        help_text=
        _('Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.'
          ),
        validators=[username_validator],
        error_messages={
            'unique': _("A user with that username already exists.")
        },
        widget=forms.TextInput(attrs={'placeholder': 'Username'}))

    class Meta:
        model = User
        fields = ["username", "email", "password1", "password2"]
Example #8
0
 class Meta:
     model = Model
     fields = ['make','name']
     widgets = {
         'name': forms.TextInput(attrs={'class':'form-control'}),
     
     }
Example #9
0
class LoginForm(AuthenticationForm):
    username = UsernameField(widget=forms.TextInput(
        attrs={'autofocus': True, 'class': 'form-control'}))
    password = forms.CharField(
        label=_("Password"),
        strip=False,
        widget=forms.PasswordInput(
            attrs={'autocomplete': 'current-password', 'class': 'form-control'}),
    )

    error_messages = {
        'invalid_login': _(
            "Please enter a correct %(username)s and password. Note that both "
            "fields may be case-sensitive."
        ),
        'inactive': _("This account is not verified."),
    }

    def __init__(self, request=None, *args, **kwargs):
        """
        The 'request' parameter is set for custom auth use by subclasses.
        The form data comes in via the standard 'data' kwarg.
        """
        self.request = request
        self.user_cache = None
        super().__init__(*args, **kwargs)
Example #10
0
 class Meta:
     model = FaultLocationPart
     fields = ['faultlocation','name']
     widgets = {
         'name': forms.TextInput(attrs={'class':'form-control'}),
     
     }
Example #11
0
    class Meta:
        model = Post
        fields = ("title", "desc")
        labels = {
            'desc': 'Discription',
        }

        widgets = {
            'title': forms.TextInput(attrs={'class': 'form-control'}),
            'desc': forms.Textarea(attrs={'class': 'form-control'}),
        }
Example #12
0
class LoginForm(forms.Form):
    username = forms.CharField(
        max_length=63,
        widget=forms.TextInput(attrs={'placeholder': 'USERNAME'}))
    password = forms.CharField(
        max_length=63,
        widget=forms.PasswordInput(attrs={'placeholder': 'PASSWORD'}))

    class Meta:
        model = User
        fields = ["username", "password"]
Example #13
0
class LoginForm(AuthenticationForm):
    username = UsernameField(widget=forms.TextInput(attrs={
        'autofocus': True,
        'class': 'form-control'
    }))
    password = forms.CharField(
        label=_("Password"),
        strip=False,
        widget=PasswordInput(attrs={
            'autocomplete': 'current-password',
            'class': 'form-control'
        }))
Example #14
0
class AuthenticationForm(django.contrib.auth.forms.AuthenticationForm):

    error_messages = {
        'invalid_login':
        "******"
        "Note that both fields may be case-sensitive.",
    }

    username = django.contrib.auth.forms.UsernameField(
        label='Username or email',
        max_length=254,
        widget=forms.TextInput(attrs={'autofocus': True}),
    )
Example #15
0
class UserUpdateForm(forms.ModelForm):
    class Meta:
        model = User

        fields = [
            "first_name", "last_name", "day_working_time", "time_flexibility",
            "job_position", "job_tasks"
        ]

    first_name = forms.CharField(widget=forms.TextInput())
    first_name.label = "Nombre"
    last_name = forms.CharField(widget=forms.TextInput())
    last_name.label = "Apellidos"
    day_working_time = forms.TimeField(widget=forms.TextInput())
    day_working_time.label = "Jornada diaria"
    time_flexibility = forms.BooleanField(widget=forms.CheckboxInput(),
                                          required=False)
    time_flexibility.label = "Flexibilidad horaria"
    job_position = forms.CharField(widget=forms.TextInput())
    job_position.label = "Puesto de trabajo"
    job_tasks = forms.CharField(widget=forms.Textarea())
    job_tasks.label = "Tareas encomendadas de forma presencial"
Example #16
0
class BootstrapAuthenticationForm(AuthenticationForm):
    """Authentication form which uses boostrap CSS."""
    username = forms.CharField(max_length=254,
                               widget=forms.TextInput({
                                   'class':
                                   'form-control',
                                   'placeholder':
                                   'User Name'
                               }))
    password = forms.CharField(label=_("Password"),
                               widget=forms.PasswordInput({
                                   'class':
                                   'form-control',
                                   'placeholder':
                                   'Password'
                               }))
Example #17
0
    class OrganizationUserChangeForm(UserChangeForm):
        username = None
        email = forms.CharField(label=_t("Email"),
                                widget=forms.TextInput(
                                    attrs={
                                        'maxlength': 150,
                                        'placeholder': _t("Email"),
                                        'autocomplete': 'off',
                                        'autofocus': 'autofocus'
                                    }))

        class Meta(django.contrib.auth.forms.UserChangeForm.Meta):
            model = User
            fields = [
                "first_name", "last_name", "email", "ensure_home_directory"
            ]
            if ENABLE_ORGANIZATIONS.get():
                fields.append('organization')  # Because of import logic

        def __init__(self, *args, **kwargs):
            super(OrganizationUserChangeForm, self).__init__(*args, **kwargs)

            if self.instance.id:
                self.fields['email'].widget.attrs['readonly'] = True

            self.fields['organization'] = forms.ChoiceField(
                choices=((get_user_request_organization().id,
                          get_user_request_organization()), ),
                initial=get_user_request_organization())

        def clean_organization(self):
            try:
                return Organization.objects.get(
                    id=int(self.cleaned_data.get('organization')))
            except:
                LOG.exception('The organization does not exist.')
                return None
Example #18
0
 class Meta:
     model = Revista
     fields = ('nombre',)
     widgets = {
         'nombre': forms.TextInput(attrs={'class': 'form-control'}),
     }
Example #19
0
class SignupForm(UserCreationForm):
    username = forms.CharField(max_length=254,
                               widget=forms.TextInput({
                                   'class': 'form-control',
                                   'placeholder': 'Username'
                               }))
    first_name = forms.CharField(max_length=30,
                                 required=False,
                                 help_text='Optional.',
                                 widget=forms.TextInput({
                                     'class':
                                     'form-control',
                                     'placeholder':
                                     'First Name'
                                 }))
    last_name = forms.CharField(max_length=30,
                                required=False,
                                help_text='Optional.',
                                widget=forms.TextInput({
                                    'class':
                                    'form-control',
                                    'placeholder':
                                    'Last Name'
                                }))
    email = forms.EmailField(max_length=254,
                             required=True,
                             widget=forms.TextInput({
                                 'class':
                                 'form-control',
                                 'placeholder':
                                 'Email address'
                             }))
    password1 = forms.CharField(label=_("Password"),
                                widget=forms.PasswordInput({
                                    'class':
                                    'form-control',
                                    'placeholder':
                                    'Create password'
                                }))
    password2 = forms.CharField(label=_("Password"),
                                widget=forms.PasswordInput({
                                    'class':
                                    'form-control',
                                    'placeholder':
                                    'Repeat password'
                                }))

    class Meta:
        model = User
        fields = (
            'username',
            'first_name',
            'last_name',
            'email',
            'password1',
            'password2',
        )

        def clean_email(self):
            # Get the email
            email = self.cleaned_data.get('email')

            # Check to see if any users already exist with this email as a username.
            try:
                match = User.objects.get(email=email)
            except User.DoesNotExist:
                # Unable to find a user, this is fine
                return email

            # A user was found with this as a username, raise an error.
            raise forms.ValidationError(
                'This email address is already in use.')