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

254
Vistas
How to add a timepicker only in my django project?

I am new to django and web development. I want to implement a timepicker only for my website. I don't know how to add it to my models and forms? and how should I implement the timepicker whether using bootstrap or jquery. Is there any easy way to do that?

forms.py

from django import forms 
from .models import Post
class PostForm(forms.ModelForm):
    class Meta:
        model = Post
        fields = ['title', 'content','chamber','address','fees','days','hours']

        widgets = {
        'hours':forms.DateField(widget=forms.DateInput(attrs={'class':'timepicker'}))
        }

models.py

class Post(models.Model):
    author = models.ForeignKey(
        settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    title = models.CharField('Doctor\'s Name',max_length=200)
    content = models.CharField('Specialty',max_length=200)
    chamber = models.CharField('Chamber\'s Name',max_length=200)
    address = models.CharField('Address',max_length=100)
    fees = models.IntegerField(default=0)

    days = myFields.DayOfTheWeekField()
    hours = models.DateField('Visiting Hours')
    liked = models.ManyToManyField(
        settings.AUTH_USER_MODEL, blank=True, related_name='liked')
    date_posted = models.DateTimeField(default=timezone.now)

    objects = PostManager()

    class Meta:
        ordering = ('-date_posted', )

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return reverse('post_detail', kwargs={'pk': self.pk})

I want to add a timepicker in the hours fields and post it to the models too. Don't know what models.field should I use and what form since I am at the very beginning level of django

The timepicker should look somewhat similar like this. enter image description here

about 4 years ago · Juan Pablo Isaza
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