models Django invalid literal for int() with base 10: 'None'
<p>I am new to Django, I am tring to make a Blog here is my models </p>

<pre><code>from django.db import models
from django.contrib.auth.models import User


class UserProfile(models.Model):
    name = models.OneToOneField(User)

    def __unicode__(self):
        return self.user.user_name


class Category(models.Model):
    category = models.CharField(max_length=150)

    def __str__(self):
        return self.category


class Blog(models.Model):
    title = models.CharField(max_length=150, default="No title")
    body = models.TextField(default="None")
    creation_date = models.DateTimeField(auto_now_add=True)
    author = models.ForeignKey(UserProfile, default=1)
    category = models.ForeignKey(Category, default="None")

    def __str__(self):
        return self.title


class Comment(models.Model):
    comment = models.TextField(default="")
    blog = models.ForeignKey(Blog)
</code></pre>

<p>but when i run the command:</p>

<blockquote>
  <p>python manage.py migrate </p>
</blockquote>

<p>i get the</p>

<blockquote>
  <p>ValueError: invalid literal for int() with base 10: 'None'</p>
</blockquote>

<p>I tried to delete the old migration file and migrate again but I got the same error, what should I do? </p>

<p>Instead of <code>default="None"</code>, specify <code>null=True</code> to allow null for foreign key:</p>

<pre><code>category = models.ForeignKey(Category, null=True)
</code></pre>

python django django-models