In the commentary on the answer to this question, I asked how to remove a field with a default value. To summarize, example 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)
and my question to the code:
How to delete a field deadlineagain and also delete a get_deadlinefunction? I deleted the field with the function for the default value, but now Django crashes at startup after deleting the function. I could manually change the migration, which would be normal in this case, but what if you just changed the default function and wanted to delete the old function?
I ended up deleting the default part related to it, but how to remove it?
The only way I can think of is to deflate migrations so that the migration with the function disappears, but this is not always an option.