python - Best way to get future event from a date and a time attribute -
in 1 of django application have object both date , time attribute, , don't wish use datetime single attribute.
for sake of example let's call object "meeting":
class meeting(models.model): publication_date = models.datefield() publication_time = models.timefield() now meetings in future given current time
i using query:
meeting.objects.filter(publication_date__gte=datetime.date.today()).exclude(publication_date= datetime.date.today(), publication_time__lt = datetime.datetime.now()).order_by('publication_date', 'publication_time')
but feel there might more efficient way
nope correct way given constraint of not using datetime field. why don't want use datetime field don't know.
Comments
Post a Comment