Reputation: 155
In models.py
I have
class myModel:
period = models.CharField(max_length = 100, blank=True)
the period
should contain something like: DD:HH:MM:SS
.
In the HTML template, I want this field to be in four different textbox input fields. Is there a way to do this in Django?
Upvotes: 4
Views: 3366
Reputation: 599480
This is well documented: you need to create a subclass of forms.MultiValueField, which implements a compress
method which returns the combined value of the fields. Note that there is already a SplitDateTimeField, but that just have two separate fields for each of the date and time.
Upvotes: 3