django-migrations

Django relation error when running make migrations

扶醉桌前 提交于 2019-12-11 06:48:30
问题 Hey I am attempting to initialize a new database, but I am running into some issues setting up the migrations. The error I am getting appears to stem from setting up my forms. In a form I am using, I am creating a choice field as so: from django import forms from ..custom_admin import widgets, choices class MemberForm(forms.Form): provinces = forms.ChoiceField(label='Provinces', choices=choices.PROVINCE_CHOICES, required=True) where PROVINCE_CHOICES comes from here: from ..base.models import

dependencies reference nonexistent parent node error in Django

我的未来我决定 提交于 2019-12-11 06:46:38
问题 So, I am learning Django using Django By Example book. I moved to a new chapter where I needed to make a new project and app. This is what I did. djnago-admin startproject myshop cd to myshop directory django-admin startapp shop python manage.py migrate I am unable to migrate with the follwing error. django.db.migrations.exceptions.NodeNotFoundError: Migration django.db.migrations.exceptions.NodeNotFoundError: Migration auth.0009_user_following dependencies reference nonexistent parent node

How to add custom migrations to external Django apps

我与影子孤独终老i 提交于 2019-12-11 04:49:42
问题 I've done some monkeypatching to some third-party apps in my custom Django 1.10 app, and now, when I try to create an initial migration, it also generates migrations for these external apps, but it puts those migrations in my virtualenv's site-packages directory, where they can't be version controlled. Moreover, the monkeypatching doesn't actually change the schema. I'm just changing the verbose name and help text to be more user-friendly. There are no changes being made to the database, so

Django-migrations in Django 1.7 detects model changes but does not apply them on migrate

拜拜、爱过 提交于 2019-12-11 02:32:01
问题 I have been trying to synchronize changes to a model in a Django app using migrations in 1.7 (postgres 9.1 - let me know if you need more details of my environment), but manage.py migrate doesn't seem to do anything, and sqlmigrate doesn't emit any SQL. I thought Django 1.7 - "No migrations to apply" when run migrate after makemigrations might be applicable to my situation, and I did find some history in the django_migrations table in my database. I deleted the records for the app I am trying

Django model for a Postgres view

℡╲_俬逩灬. 提交于 2019-12-10 20:12:40
问题 Edit: There seems to be some confusion about what I'm asking. That model is for the Postgres view that I created in migration 0009. I was under the impression that Django won't generate a migration for a model if it has the managed = False option. However, it's still trying to create it. Also, I'm using Django 1.8 with Python 3.4. I'm having trouble creating a Django model for a Postgres view, using these links as a guide: drdaeman and eceppda's answer in Can I use a database view as a model

Django Table already exist

爱⌒轻易说出口 提交于 2019-12-10 16:38:44
问题 Here is my Django Migration file. When I run python manage.py makemigrations/migrate I get this error. Error:- django.db.utils.OperationalError: (1050, "Table 'tickets_duration' already exists") I have dropped the database and running it but still get the same error. class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Duration', fields=[ ('Id', models.UUIDField(primary_key=True, db_column=b'duration_id', default=uuid.uuid4, serialize=False,

How to fake migrations for not to create a specific existing intermediary table

99封情书 提交于 2019-12-10 14:48:23
问题 I have following models class VucutBolgesi(models.Model): site = models.ForeignKey(Site) bolge = models.CharField(verbose_name="Bölge", max_length=75) hareketler = models.ManyToManyField("Hareket", verbose_name="Hareketler", null=True, blank=True, help_text="Bölgeyi çalıştıran hareketler") class Hareket(models.Model): site = models.ForeignKey(Site) hareket = models.CharField(verbose_name="Hareket", max_length=75 ) bolgeler = models.ManyToManyField(VucutBolgesi, verbose_name="Çalıştırdığı

Why there is need to push django migrations to version control system

核能气质少年 提交于 2019-12-10 14:33:48
问题 This is a common practice that people working on django project usually push migrations to the version control system along with other code. My question is why this practice is so common? Why not just push the updated models and everyone generate migrations locally. This approach can reduce the effort for resolving migrations conflicts too. 回答1: If you didn't commit them to a VCS then what would happen is people would make potentially conflicting changes to the model. When finally ready to

Automatically generate custom migrations in Django

断了今生、忘了曾经 提交于 2019-12-10 09:29:21
问题 Django provides a really nice feature called makemigrations where it will create migration files based on the changes in models. We are developing a module where we will want to generate custom migrations. I haven't found much info about creating custom migrations in the Django docs. There is documentation on the various Operation classes that can yield migrations but there's nothing about creating custom Operation classes that can yield custom migrations. The autodetector module for

Trying to make a PostgreSQL field with a list of foreign keys in Django

谁都会走 提交于 2019-12-10 01:11:54
问题 Here is what I'm trying to do: Make a model in Django that is a PostgreSQL array (database specific type), which contains foreign keys to another model. class Books(models.Model): authors = ArrayField( models.ForeignKey('my_app.Authors', default=None, null=True, blank=True), blank=True, default=list() ) When I try to makemigrations, Django gives me this error: SystemCheckError: System check identified some issues: ERRORS: my_app.Books.authors: (postgres.E002) Base field for array cannot be a