makemigrations

django makemigrations to rename field without user input

佐手、 提交于 2020-04-19 07:56:28
问题 I have a model with CharField named oldName . I want to rename the field to newName . When I run python manage.py makemigrations , I get a confirmation request "Did you rename model.oldName to model.newName (a CharField)? [y/N]" However, I want to run the whole thing inside a docker container and there is no provision to provide the user input. Is there a way to force the migration without need for user input? PS: I tried --noinput option with makemigrations. In this case migrations are not

django makemigrations to rename field without user input

孤街醉人 提交于 2020-04-19 07:54:09
问题 I have a model with CharField named oldName . I want to rename the field to newName . When I run python manage.py makemigrations , I get a confirmation request "Did you rename model.oldName to model.newName (a CharField)? [y/N]" However, I want to run the whole thing inside a docker container and there is no provision to provide the user input. Is there a way to force the migration without need for user input? PS: I tried --noinput option with makemigrations. In this case migrations are not

django makemigrations to rename field without user input

你说的曾经没有我的故事 提交于 2020-04-19 07:53:39
问题 I have a model with CharField named oldName . I want to rename the field to newName . When I run python manage.py makemigrations , I get a confirmation request "Did you rename model.oldName to model.newName (a CharField)? [y/N]" However, I want to run the whole thing inside a docker container and there is no provision to provide the user input. Is there a way to force the migration without need for user input? PS: I tried --noinput option with makemigrations. In this case migrations are not

django makemigrations to rename field without user input

做~自己de王妃 提交于 2020-04-19 07:52:42
问题 I have a model with CharField named oldName . I want to rename the field to newName . When I run python manage.py makemigrations , I get a confirmation request "Did you rename model.oldName to model.newName (a CharField)? [y/N]" However, I want to run the whole thing inside a docker container and there is no provision to provide the user input. Is there a way to force the migration without need for user input? PS: I tried --noinput option with makemigrations. In this case migrations are not

django makemigrations to rename field without user input

你。 提交于 2020-04-19 07:52:08
问题 I have a model with CharField named oldName . I want to rename the field to newName . When I run python manage.py makemigrations , I get a confirmation request "Did you rename model.oldName to model.newName (a CharField)? [y/N]" However, I want to run the whole thing inside a docker container and there is no provision to provide the user input. Is there a way to force the migration without need for user input? PS: I tried --noinput option with makemigrations. In this case migrations are not

Renaming models(tables) in Django

人走茶凉 提交于 2019-12-30 08:22:06
问题 so I've already created models in Django for my db, but now want to rename the model. I've change the names in the Meta class and then make migrations/migrate but that just creates brand new tables. I've also tried schemamigration but also not working, I'm using Django 1.7 Here's my model class ResultType(models.Model): name = models.CharField(max_length=150) ut = models.DateTimeField(default=datetime.now) class Meta: db_table = u'result_type' def __unicode__(self): return self.name Cheers

Renaming models(tables) in Django

旧城冷巷雨未停 提交于 2019-12-30 08:21:10
问题 so I've already created models in Django for my db, but now want to rename the model. I've change the names in the Meta class and then make migrations/migrate but that just creates brand new tables. I've also tried schemamigration but also not working, I'm using Django 1.7 Here's my model class ResultType(models.Model): name = models.CharField(max_length=150) ut = models.DateTimeField(default=datetime.now) class Meta: db_table = u'result_type' def __unicode__(self): return self.name Cheers

Django-polymorphic models having issues making migrations on 1.7

痞子三分冷 提交于 2019-12-22 10:04:06
问题 I am using Django 1.7 and django-polymorphic for my models class ReferenceItem(PolymorphicModel): created_at = models.DateTimeField(_('date created'), auto_now_add=True, db_index=True) updated_at = models.DateTimeField(_('date modified'), auto_now=True, db_index=True) uuid = UUIDField(auto=True, unique=True) description = models.CharField(max_length=255) class OrderItem(ReferenceItem): order = models.ForeignKey('Order', related_name='items') sku = models.CharField(max_length=255) quantity =

Django makemigrations omits some fields from model

▼魔方 西西 提交于 2019-12-13 07:39:45
问题 In my django app I've created a model like that: class Plan_miesieczny_aktualny(models.Model): id = models.CharField(max_length=30, primary_key=True) pozycja_planu = models.ForeignKey('Pozycje_planu', to_field='id') miesiac = models.IntegerField liczba = models.DecimalField cena = models.DecimalField pakiet = models.ForeignKey('Pakiet', to_field='id') kod_grupy = models.IntegerField(null=True) But initial makemigrations has produced that: migrations.CreateModel( name='Plan_miesieczny_aktualny