H
H
hukabuk2019-03-16 01:58:46
PostgreSQL
hukabuk, 2019-03-16 01:58:46

Django why migration error?

We have: python3, django2, postgresql.
There was a model:

class UserSettings(models.Model):
    """Настройки юзера"""
    user = models.OneToOneField(
        to=User,
        on_delete=models.CASCADE,
        related_name='settings',
        verbose_name='Юзер'
    )

Then I expanded it with another model:
class Folder(models.Model):
    """Папка"""
    title = models.CharField(
        max_length=255,
        verbose_name='Название'
    )

class UserSettings(models.Model):
    """Настройки юзера"""
    user = models.OneToOneField(
        to=User,
        on_delete=models.CASCADE,
        related_name='settings',
        verbose_name='Юзер'
    )
   folder = models.ForeignKey(
        to=Folder,
        on_delete=None,
        null=True,
        blank=True
    )

But, due to the fact that I had old migration files, I got errors there. After an hour of magic, at least you can walk through the pages, but on pages that use the folder field in the UserSettings model, an error appears: ProgrammingError relation "accounts_folder" does not exist.
Please tell me how can I solve it? Tried to comment this field and do make/migrate - without success.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Belousov, 2019-03-23
@vladbelouosoff

ProgrammingError relation "accounts_folder" does not exist.

Apparently they didn'tpython manage.py makemigrations

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question