title: How to remove a default value function in Django
body: <p>In a comment to <a href="https://stackoverflow.com/a/15289517/1031534">this question answer</a> I asked how to remove a field with a default value function. To sum up, the example code is:</p>
  
  <pre><code>def get_deadline():
      return datetime.today() + timedelta(days=20)
  
  class Bill(models.Model):
      name = models.CharField(max_length=50)
      customer = models.ForeignKey(User, related_name='bills')
      date = models.DateField(default=datetime.today)
      deadline = models.DateField(default=get_deadline)
  </code></pre>
  
  <p>and my question to the code is: </p>
  
  <blockquote>
    <p>How do you remove the <code>deadline</code> field again while also deleting the
    <code>get_deadline</code> function? I have removed a field with a function for a
    default value, but now Django crashes on startup after removing the
    function. I could manually edit the migration, which would be ok in
    this case, but what if you simply changed the default function, and
    wanted to remove the old function?</p>
  </blockquote>
  
  <p>I ended up removing the default part of the migration that referred to it, but how do you remove it nicely?</p>
  
  <p>The only way I can think of is to squash the migrations, such that the migration using the function disappears, but that is not always an option.</p>