title: Django: TypeError: int() argument must be a string, a bytes-like object or a number, not
body: <p>Please help! I tried searching for an answer, but I think this issue is too specific to have a generalized enough solution. </p>
  
  <p>It's very difficult for me to pin point when, exactly, it is that this error started. I've Attempted too many changes now to know when the site was last working. I'm very new to this. And entirely self-taught, at that. I can assure you, it will be apparent.</p>
  
  <p>when attempting to migrate I receive this error:</p>
  
  <pre><code>when attempting to migrate I receive this error:
  
       Apply all migrations: admin, auth, contenttypes, purchase_log, sessions
  Running migrations:
    Applying purchase_log.0009_auto_20161005_1524...Traceback (most recent call la
    File "manage.py", line 22, in &lt;module&gt;
      execute_from_command_line(sys.argv)
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      utility.execute()
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      self.fetch_command(subcommand).run_from_argv(self.argv)
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      self.execute(*args, **cmd_options)
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      output = self.handle(*args, **options)
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      fake_initial=fake_initial,
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_i
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      state = migration.apply(state, schema_editor)
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      operation.database_forwards(self.app_label, schema_editor, old_state, projec
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      field,
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      self._remake_table(model, create_fields=[field])
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      self.effective_default(field)
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      default = field.get_db_prep_save(default, self.connection)
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      return self.target_field.get_db_prep_save(value, connection=connection)
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      prepared=False)
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      value = self.get_prep_value(value)
    File "C:\Users\jdcar\AppData\Local\Programs\Python\Python35-32\lib\site-packag
      return int(value)
  TypeError: int() argument must be a string, a bytes-like object or a number, not
  </code></pre>
  
  <p>I'm going insane, and have no idea where to start! Please help!</p>
  
  <p>edit: Here is the .models.py</p>
  
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  
  
  class Store(models.Model):
      name = models.CharField(max_length=250)
      owner = models.ForeignKey(User)
  
      def __str__(self):
          return self.name
  
  
  class Product(models.Model):
      type = models.CharField(max_length=250)
      owner = models.ForeignKey(User)
  
      def __str__(self):
          return self.type
  
  
  class Receipt(models.Model):
      store = models.ForeignKey(Store)
      date = models.DateField()
      line_items = models.ManyToManyField(Product, through='ReceiptProduct')
      owner = models.ForeignKey(User)
  
      def __str__(self):
          return self.store.name + ': ' + str(self.date)
  
  
  class ReceiptProduct(models.Model):
      receipt = models.ForeignKey(Receipt)
      product = models.ForeignKey(Product)
      price = models.FloatField()
      sale = models.BooleanField()
      description = models.CharField(max_length=500, null=True, blank=True)
      owner = models.ForeignKey(User)
  
      def __str__(self):
          return self.product.type
  </code></pre>
  
  <p>edit: Here is migration 0009_auto_20161005_1524.py</p>
  
  <pre><code># -*- coding: utf-8 -*-
  # Generated by Django 1.10.1 on 2016-10-05 19:24
  from __future__ import unicode_literals
  
  from django.conf import settings
  import django.contrib.auth.models
  from django.db import migrations, models
  import django.db.models.deletion
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          migrations.swappable_dependency(settings.AUTH_USER_MODEL),
          ('purchase_log', '0008_receiptproduct_sale'),
      ]
  
      operations = [
          migrations.AddField(
              model_name='product',
              name='owner',
              field=models.ForeignKey(default=django.contrib.auth.models.User, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
          ),
          migrations.AddField(
              model_name='receipt',
              name='owner',
              field=models.ForeignKey(default=django.contrib.auth.models.User, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
          ),
          migrations.AddField(
              model_name='receiptproduct',
              name='owner',
              field=models.ForeignKey(default=django.contrib.auth.models.User, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
          ),
          migrations.AddField(
              model_name='store',
              name='owner',
              field=models.ForeignKey(default=django.contrib.auth.models.User, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
          ),
      ]
  </code></pre>