我尝试在我的模型中插入一个新字段,但我收到了一个DateTime Migration错误,所以我删除了这两个字段,并尝试运行" migrate"功能不起作用,让迁移仍然有效。
from django.db import models
from django.core.urlresolvers import reverse
class Invoice(models.Model):
active = models.BooleanField()
bu_field = models.CharField(max_length=10)
invoice_name = models.CharField(max_length=500)
sow_name = models.CharField(max_length=500)
probability = models.IntegerField()
sow_type = models.CharField(max_length=50)
sow_start_date = models.DateField()
sow_end_date = models.DateField()
project_id = models.CharField(max_length=500)
project_manager = models.CharField(max_length=500, null=True)
po_number = models.IntegerField()
sow_value = models.DecimalField(max_digits=8, decimal_places=2)
current_month = models.CharField(max_length=20)
current_year = models.CharField(max_length=5)
month_value = models.DecimalField(max_digits=8, decimal_places=2)
q1_value = models.IntegerField()
q2_value = models.IntegerField()
q3_value = models.IntegerField()
q4_value = models.IntegerField()
total_value_ofyear = models.IntegerField()
probability_month_value = models.IntegerField()
def __str__(self):
return self.invoice_name
def get_absolute_url(self):
return reverse("invoice:detail", kwargs={"id": self.id})
下面是我的Models.py文件。
{{1}}
没有新的字段,一切都恢复原状,但不是我收到此错误。