Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

597
Vistas
How to remove arrows from Django integerField without maintaining the only number input feature?

forms.py

from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from .models import Profile


class UserRegisterForm(UserCreationForm):
    email = forms.EmailField()
    registration = forms.IntegerField(label='Registration Number')

    class Meta:
        model = User
        fields = ['username', 'email','registration','password1', 'password2']

How can I remove the up and down arrows from the registration field? P.S. I want to only allow the user to input numbers in this field.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

This can be done in CSS:

Like so:

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;

You should be able to make it specific to that field by using:

#id_registration::-webkit-outer-spin-button,
#id_registration::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
over 4 years ago · Santiago Trujillo Denunciar

0

You can do this by overriding widgets in Meta class.

Like this:

from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from .models import Profile
# Import widget that you want
from django.forms import TextInput


class UserRegisterForm(UserCreationForm):
    email = forms.EmailField()
    registration = forms.IntegerField(label='Registration Number')

    class Meta:
        model = User
        fields = ['username', 'email','registration','password1', 'password2']
        widgets = {
            'registration': TextInput()
        }

Also I'm not sure but you can just try this:

class UserRegisterForm(UserCreationForm):
    email = forms.EmailField()
    # Add widget to your field
    registration = forms.IntegerField(label='Registration Number', widget=forms.TextInput())

    class Meta:
        model = User
        fields = ['username', 'email','registration','password1', 'password2']

For more info:

Overriding the default fields

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda