선풍기
선풍기

Reputation: 961

Django DateTimeField hide date

I have a model where an object is called time which is model.DateTimeField(default=datetime.now)

I also have a form where the user can specify the time, but I wanted to only have the H: M in there, not the whole datetime.

I tried using the TimeInput widget in my form, but that would give me an error upon submitting because I didn't have the 'date' portion of the DateTimeField. If I use models.TimeField for time, I lose the ability to keep track of the date in the admin page.

How can I hide the date from showing in my form?

Upvotes: 0

Views: 364

Answers (1)

선풍기
선풍기

Reputation: 961

Worked around the problem by having one model as DateTimeField and another as TimeField.

Upvotes: 1

Related Questions