title: datetime_re.match(value) // TypeError: expected string or bytes-like object
body: <p>I am running into this error when trying to run <code>python manage.py migrate</code> it seems that their could be a problem with the date fields in my <code>models.py</code></p>
  <p>Please see the following code:</p>
  <p>Models.py</p>
  <p>from django.db import models</p>
  <pre><code>class newCustomersClass(models.Model):
      customerName = models.CharField(&quot;Customer Name&quot;,max_length=50 , blank=True)
  
      addressStreetNo = models.CharField(max_length=50 , blank=True)
      addressStreet = models.CharField(max_length=50 , blank=True)
      addressSuburb = models.CharField(max_length=50, blank=True )
      addressCity = models.CharField(max_length=50, blank=True )
  
      contact = models.CharField(max_length=50, blank=True )
      mail = models.CharField(max_length=50, blank=True )
      CellNo = models.CharField(max_length=50, blank=True )
  
  class jobCardsClass(models.Model):
      customerName = models.CharField(&quot;Customer Name&quot;,max_length=50 , blank=True)
  
      addressStreetNo = models.CharField(max_length=50 , blank=True)
      addressStreet = models.CharField(max_length=50 , blank=True)
      addressSuburb = models.CharField(max_length=50, blank=True )
      addressCity = models.CharField(max_length=50, blank=True )
  
      contact = models.CharField(max_length=50, blank=True )
      mail = models.CharField(max_length=50, blank=True )
      CellNo = models.CharField(max_length=50, blank=True )
  
      jobNumber = models.CharField(max_length=50, blank=True )
      dateRecieved = models.DateTimeField(auto_now=False, auto_now_add=False)
      dateToBeCompleted = models.DateTimeField(auto_now=False, auto_now_add=False)
      instructionBy = models.CharField(max_length=50, blank=True )
      jobDoneBy = models.CharField(max_length=50, blank=True )
      timeStarted = models.TimeField(auto_now=False, auto_now_add=False)
      timeCompleted = models.TimeField(auto_now=False, auto_now_add=False)
  
      Instructions = models.TextField(max_length=255)
  
      totalCostOfJob = models.CharField(max_length=50, blank=True)
  </code></pre>
  <p>Forms.py:</p>
  <pre><code>from django import forms
  from .models import newCustomersClass, jobCardsClass
  from django.forms import ModelForm
  
  class newCustomerForm(ModelForm):
      class Meta:
          model = newCustomersClass
          fields = 'customerName', 'addressStreetNo' ,'addressStreet', 'addressSuburb' ,'addressCity'   , 'contact' , 'mail' , 'CellNo'
  
  class jobCardForm(forms.ModelForm):
      class Meta:
          model = jobCardsClass
          fields = '__all__'
          widgets = {
                      'dateRecieved': forms.SelectDateWidget,
                      'dateToBeCompleted' : forms.SelectDateWidget(),
                      'timeStarted': forms.TimeInput(attrs={'type': 'time'}),
                      'timeCompleted': forms.TimeInput(attrs={'type': 'time'}),
          }
  </code></pre>
  <p>Here is the full error message:</p>
  <pre><code>File &quot;C:\Users\KylePOG\Documents\GMA Programming\Zipherts\manage.py&quot;, line 22, in &lt;module&gt;
      main()
    File &quot;C:\Users\KylePOG\Documents\GMA Programming\Zipherts\manage.py&quot;, line 18, in main
      execute_from_command_line(sys.argv)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py&quot;, line 419, in execute_from_command_line
      utility.execute()
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py&quot;, line 413, in execute
      self.fetch_command(subcommand).run_from_argv(self.argv)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py&quot;, line 354, in run_from_argv
      self.execute(*args, **cmd_options)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py&quot;, line 398, in execute
      output = self.handle(*args, **options)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py&quot;, line 89, in wrapped
      res = handle_func(*args, **kwargs)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\migrate.py&quot;, line 244, in handle
      post_migrate_state = executor.migrate(
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\executor.py&quot;, line 117, in migrate
      state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\executor.py&quot;, line 147, in _migrate_all_forwards
      state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\executor.py&quot;, line 227, in apply_migration
      state = migration.apply(state, schema_editor)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\migration.py&quot;, line 126, in apply
      operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\operations\fields.py&quot;, line 104, in database_forwards
      schema_editor.add_field(
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\schema.py&quot;, line 330, in add_field
      self._remake_table(model, create_field=field)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\schema.py&quot;, line 191, in _remake_table
      self.effective_default(create_field)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\base\schema.py&quot;, line 310, in effective_default
      return field.get_db_prep_save(self._effective_default(field), self.connection)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\fields\__init__.py&quot;, line 842, in get_db_prep_save
      return self.get_db_prep_value(value, connection=connection, prepared=False)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\fields\__init__.py&quot;, line 1427, in get_db_prep_value
      value = self.get_prep_value(value)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\fields\__init__.py&quot;, line 1406, in get_prep_value
      value = super().get_prep_value(value)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\fields\__init__.py&quot;, line 1266, in get_prep_value
      return self.to_python(value)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\fields\__init__.py&quot;, line 1367, in to_python
      parsed = parse_datetime(value)
    File &quot;C:\Users\KylePOG\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\dateparse.py&quot;, line 107, in parse_datetime
      match = datetime_re.match(value)
  TypeError: expected string or bytes-like object
  </code></pre>
  <p>If anyone knows what the cause of this is , please assist.</p>
  <p>I have tried adding a default field to the date and time field , I have tried adding <code>null = true</code> or <code>blank = true</code></p>