Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

264
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda