title: I'm getting an datetime error while making an car renting django web application
body: <p>I'm creating an car renting web based application using django.
  And I'm getting following error even though I have removed datetime attribute or function from my code</p>
  <pre><code>python manage.py migrate       
  Operations to perform:
    Apply all migrations: admin, app, auth, contenttypes, sessions
  Running migrations:
    Applying app.0006_cart_car_cart_quantity_cart_renting_date_and_more...Traceback (most recent call last):
    File &quot;D:\Rushikesh\Code\car_rent\quickrents\manage.py&quot;, line 22, in &lt;module&gt;
      main()
    File &quot;D:\Rushikesh\Code\car_rent\quickrents\manage.py&quot;, line 18, in main 
      execute_from_command_line(sys.argv)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\core\management\__init__.py&quot;, line 446, in execute_from_command_line
      utility.execute()
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\core\management\__init__.py&quot;, line 440, in execute
      self.fetch_command(subcommand).run_from_argv(self.argv)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\core\management\base.py&quot;, line 414, in run_from_argv
      self.execute(*args, **cmd_options)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\core\management\base.py&quot;, line 460, in execute
      output = self.handle(*args, **options)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\core\management\base.py&quot;, line 98, in wrapped
      res = handle_func(*args, **kwargs)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\core\management\commands\migrate.py&quot;, line 290, in handle
      post_migrate_state = executor.migrate(
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\migrations\executor.py&quot;, line 131, in migrate
      state = self._migrate_all_forwards(
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\migrations\executor.py&quot;, line 163, in _migrate_all_forwards
      state = self.apply_migration(
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\migrations\executor.py&quot;, line 248, in apply_migration
      state = migration.apply(state, schema_editor)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\migrations\migration.py&quot;, line 131, in apply
      operation.database_forwards(
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\migrations\operations\fields.py&quot;, line 108, in database_forwards
      schema_editor.add_field(
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\backends\sqlite3\schema.py&quot;, line 381, in add_field
      self._remake_table(model, create_field=field)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\backends\sqlite3\schema.py&quot;, line 230, in _remake_table
      self.effective_default(create_field)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\backends\base\schema.py&quot;, line 410, in effective_default
      return field.get_db_prep_save(self._effective_default(field), self.connection)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\models\fields\__init__.py&quot;, line 910, in get_db_prep_save
      return self.get_db_prep_value(value, connection=connection, prepared=False)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\models\fields\__init__.py&quot;, line 1546, in get_db_prep_value
      value = self.get_prep_value(value)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\models\fields\__init__.py&quot;, line 1524, in get_prep_value
      value = super().get_prep_value(value)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\models\fields\__init__.py&quot;, line 1403, in get_prep_value
      return self.to_python(value)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\db\models\fields\__init__.py&quot;, line 1485, in to_python
      parsed = parse_datetime(value)
    File &quot;D:\Rushikesh\Code\car_rent\ecp\lib\site-packages\django\utils\dateparse.py&quot;, line 114, in parse_datetime
      return datetime.datetime.fromisoformat(value)
  TypeError: fromisoformat: argument must be str
  </code></pre>
  <p>I tried using datetime function for making <strong>My_Orders</strong> page but got same error.</p>
  <p>So I removed the datetime code to make it like before but then also getting same error.</p>
  <p>Can't resolve this problem.</p>
  <p>When I'm trying to run the code it is executing.</p>
  <p>But warns to make 6 migrations as following.</p>
  <p><a href="https://i.stack.imgur.com/HUPXJ.png" rel="nofollow noreferrer">Here is the image that shows 6 remaining migrations</a></p>
  <p>But when I'm trying to make migrations the above error pops up.</p>
  <p>Here is code from my models.py file.</p>
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  from django.core.validators import MaxValueValidator, MinValueValidator
  STATE_CHOICE = (
      ('Maharashtra','Maharashtra'),
      ('Rajasthan','Rajasthan'),
      ('Delhi','Delhi'),
      ('Tamil Nadu','Tamil Nadu'),
      ('Madhya Pradesh','Madhya Pradesh'),
      ('Gujrat','Gujrat'),
  )
  class Customer(models.Model):
      user = models.ForeignKey(User, on_delete=models.CASCADE)
      name = models.CharField(max_length=200)
      locality = models.CharField(max_length=200)
      city = models.CharField(max_length=50)
      zipcode = models.IntegerField()
      state = models.CharField(choices=STATE_CHOICE, max_length=50)
      mobile = models.IntegerField()
  
      def __str__(self):
          return str(self.id)
  
  CATEGORY_CHOICES = (
      ('H','HATCHBACK'),
      ('S','SEDAN'),
      ('SUV','SUV'),
      ('MUV','MUV'),
  )
  
  class Car(models.Model):
      title = models.CharField(max_length=100)
      renting_price = models.FloatField()
      description = models.TextField()
      mileage=models.CharField(max_length=2)
      brand = models.CharField(max_length=50)
      category = models.CharField(choices=CATEGORY_CHOICES, max_length=3)
      car_image = models.ImageField(upload_to='carimg')
  
      def __str__(self):
          return str(self.id)
  
  class My_Orders(models.Model):
      user = models.ForeignKey(User, on_delete=models.CASCADE)
      car = models.ForeignKey(Car, on_delete=models.CASCADE)
      quantity = models.PositiveIntegerField(default=1)
  
  
      def __str__(self):
          return str(self.id)
      
  STATUS_CHOICES = (
      ('Accepted','Accepted'),
      ('On The Way','On The Way'),
      ('Delivered','Delivered'),
      ('Cancel','Cancel'),
  )
  
  class OrderPlaced(models.Model):
      user = models.ForeignKey(User, on_delete=models.CASCADE)
      customer = models.ForeignKey(Customer, on_delete=models.CASCADE)
      car = models.ForeignKey(Car, on_delete=models.CASCADE)
      quantity = models.PositiveIntegerField(default=1)
      status = models.CharField(max_length=50,choices=STATUS_CHOICES,default='Pending')
  
      def __str__(self):
          return str(self.id)
  </code></pre>
  <p>migration file 1</p>
  <pre><code>    operations = [
          migrations.AddField(
              model_name='cart',
              name='car',
              field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='app.car'),
              preserve_default=False,
          ),
          migrations.AddField(
              model_name='cart',
              name='quantity',
              field=models.PositiveIntegerField(default=1),
          ),
          migrations.AddField(
              model_name='cart',
              name='renting_date',
              field=models.DateTimeField(default=1),
              preserve_default=False,
          ),
          migrations.DeleteModel(
              name='My_Order',
          ),
      ]
  
  </code></pre>
  <p>migration file 2</p>
  <pre><code>    operations = [
          migrations.AlterField(
              model_name='cart',
              name='renting_date',
              field=models.DateField(),
          ),
      ]
  
  </code></pre>
  <p>migration file 3</p>
  <pre><code>    operations = [
          migrations.AddField(
              model_name='orderplaced',
              name='ordered_date',
              field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
              preserve_default=False,
          ),
      ]
  </code></pre>
  <p>GitHub link for my project
  <a href="https://github.com/Rushikesh53/car-renting.git" rel="nofollow noreferrer">https://github.com/Rushikesh53/car-renting.git</a></p>