Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

256
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!