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

119
Vistas
How to display the current value of the range input field (slider)

What you want to achieve

イメージ説明

I want to input numbers in the django form like this.

Current code

class Comment_movie_CreateForm (ModelForm):
    class Meta:
        model = Comment_movie
        fields = ('comment','stars')
    comment = forms.CharField (required = False, label ='comment', max_length = 1000)
    stars = forms.FloatField (required = False, label ='stars', widget = forms.TextInput (
       attrs = {'type':'range','id':'form_homework', "class": "no_resize",'min': '0','max': '10','step': '0.1' })))
    def clean (self):
        cleaned_data = super (). clean ()
        return cleaned_data
    def clean_stars (self):
        stars = self.cleaned_data ['stars']
        if stars! = None:
            if stars <0 or stars> 10:
                raise forms.ValidationError ("The rating input is incorrect.")
            return stars
        else: else:
            raise forms.ValidationError ("The rating input is incorrect.")
    def clean_comment (self):
        comment = self.cleaned_data ['comment']
        if len (comment)> 1000:
            raise forms.ValidationError ("There are too many characters.")
        elif len (comment) == 0:
            raise forms.ValidationError ("Please enter the characters.")
        return comment
    def __init__ (self, * args, ** kwargs):
        super () .__ init__ (* args, ** kwargs)
        self.label_suffix = ""
<form method="POST" enctype="multipart/form-data">
        {% csrf_token %}
        {{ form }}
        {% if comment_tv %}
        <button type="submit">Edit Comment</button>
        <button type="submit" name="action" value="delete">Delete Comment</button>
        {% else %}
        <button type="submit">Post Comment</button>
        {% endif %}
    </form>

What you want to ask

I want to make a slide bar as it is as shown in the picture. How do I set up CSS and javascript?

about 4 years ago · Santiago Gelvez
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