[英]No changes detected when i excute Python manage.py makemigrations and migrate
I tried to make migration using python manage.py migrations tithe
but nothing is detected. 我尝试使用
python manage.py migrations tithe
进行迁移,但未检测到任何东西。 I have even changed my database to postgres, but nothing has changed. 我什至将数据库更改为postgres,但没有任何改变。 Even
python manage.py migrate
is not working. 甚至
python manage.py migrate
也无法正常工作。 What could be the problem? 可能是什么问题呢?
@localhost church]$ python manage.py migrate tithe
Operations to perform:
Apply all migrations: (none)
Running migrations:
No migrations to apply.
this is my model.py code 这是我的model.py代码
from __future__ import unicode_literals
from django.utils import timezone
from django.contrib.auth.models import User
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.signals import setting_changed
from django.dispatch import receiver
from django.db import models
# Create your models here.
class tithe(models.Model):
member_code = models.ForeignKey(settings.AUTH_USER_MODEL)
member = models.CharField(max_length=45)
receipt_code = models.CharField(max_length=45, unique=True)
tithes = models.IntegerField()
combinedoffering = models.IntegerField()
campmeetingoffering = models.IntegerField()
churchbuilding = models.IntegerField()
conference = models.IntegerField()
localchurch = models.IntegerField()
funds = models.IntegerField()
total = models.IntegerField()
created_date = models.DateTimeField(
default=timezone.now)
published_date = models.DateTimeField(
blank=True, null=True)
def publish(self):
self.published_date = timezone.now()
self.save()
def __str__(self):
return self.receitcode
class Meta:
abstract = True
the program works by removing abstract = True
in the class meta.after removing it when i run python manage.py makemigrations tithe
and python manage.py migrate tithe
it works wells 该程序通过在类meta中删除
abstract = True
。在我运行python manage.py makemigrations tithe
和python manage.py migrate tithe
python manage.py makemigrations tithe
一税后将其删除
from __future__ import unicode_literals
from django.utils import timezone
from django.contrib.auth.models import User
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.signals import setting_changed
from django.dispatch import receiver
from django.db import models
# Create your models here.
class tithe(models.Model):
member_code = models.ForeignKey(settings.AUTH_USER_MODEL)
member = models.CharField(max_length=45)
receipt_code = models.CharField(max_length=45, unique=True)
tithes = models.IntegerField()
combinedoffering = models.IntegerField()
campmeetingoffering = models.IntegerField()
churchbuilding = models.IntegerField()
conference = models.IntegerField()
localchurch = models.IntegerField()
funds = models.IntegerField()
total = models.IntegerField()
created_date = models.DateTimeField(
default=timezone.now)
published_date = models.DateTimeField(
blank=True, null=True)
def publish(self):
self.published_date = timezone.now()
self.save()
def __str__(self):
return self.receitcode
class Meta:
unique_together = ["receipt_code"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.