title: How to split a form field to display multiple values in Django
body: <p>My Journey model contains two fields, distance and time:</p>
  <pre><code>class Journey(models.Model):
      distance = models.PositiveIntegerField(default=0)
      time = models.PositiveIntegerField(default=0)
  </code></pre>
  <p>I am trying to create a Modelform where the time field will be split to display inputs for 'hrs', 'min' and 'sec'. I would then like these values to be compressed in order to return one single value. Currently my forms.py looks like this:</p>
  <pre><code>from django import forms
  from django.forms import MultiWidget
  from .models import Journey
  
  
  class DistanceTimeModelForm(forms.ModelForm):
      time = forms.MultiValueField(
          widget=MultiWidget(
              widgets=[
                  forms.IntegerField(attrs={&quot;placeholder&quot;: &quot;hrs&quot;}),
                  forms.IntegerField(attrs={&quot;placeholder&quot;: &quot;min&quot;}),
                  forms.IntegerField(attrs={&quot;placeholder&quot;: &quot;sec&quot;}),
              ]
          ),
          require_all_fields=True,
          error_messages={&quot;incomplete&quot;: &quot;Please enter a number&quot;},
      )
  
      class Meta:
          model = Journey
          fields = [&quot;distance&quot;, &quot;time&quot;]
  </code></pre>
  <p>I am receiving <code>TypeError: __init__() got an unexpected keyword argument 'attrs'</code> when I attempt to run the server. Is anyone able to help me understand how to fix this? I have been searching for a solution online for some time but so far am still stumped.</p>