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

242
Visualizações
Saving a Date in a Coisefield - Django?

so what I'm trying to build is basically a calendar. For this, a user has to choose a beginning date and time for an event as well as an end time. Everything then has to be stored - of course - in the database.

I want to realize that by using a ChoiseField (unless there is a better solution). How would it be possible to generate all the dates of the month in a coisefield since some months are 30 days others have a different length etc.? Same with the hours of a day?

I cant seem to come up with a working approach? How would one approach this problem? suggestions?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I would do it as two fields:

#models.py
class Event(models.Model):     
         start = models.DateTimeField(default=datetime.now())
         end = models.DateTimeField()

and for calendar (=widget) i would use this or some similar plugin: https://github.com/nkunihiko/django-bootstrap3-datetimepicker

over 4 years ago · Santiago Trujillo Relatório
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