question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Your models have changes that are not yet reflected in a migration

See original GitHub issue

On Django 1.7, oscar 1.1, after running manage.py migrate for the first time, it seems to run fine without error.

Subsequent runs of managy.py migrate give the following error:

...
Running migrations:
  No migrations to apply.
  Your models have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

If I run manage.py makemigrations the following files are created:

site-packages/oscar/apps/customer/migrations/0002_auto_20150723_2301.py:

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import oscar.models.fields.autoslugfield
import django.core.validators


class Migration(migrations.Migration):

    dependencies = [
        ('customer', '0001_initial'),
    ]

    operations = [
        migrations.AlterField(
            model_name='communicationeventtype',
            name='code',
            field=oscar.models.fields.autoslugfield.AutoSlugField(populate_from=b'name', validators=[django.core.validators.RegexValidator(regex=b'^[a-zA-Z_][0-9a-zA-Z_]*$', message="Code can only contain the letters a-z, A-Z, digits, and underscores, and can't start with a digit.")], editable=False, max_length=128, separator='_', blank=True, help_text='Code used for looking up this event programmatically', unique=True, verbose_name='Code'),
            preserve_default=True,
        ),
    ]

site-packages/oscar/apps/catalogue/migrations/0006_auto_20150723_2301.py:

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import django.core.validators
import oscar.core.validators


class Migration(migrations.Migration):

    dependencies = [
        ('catalogue', '0005_auto_20150604_1450'),
    ]

    operations = [
        migrations.AlterField(
            model_name='productattribute',
            name='code',
            field=models.SlugField(max_length=128, verbose_name='Code', validators=[django.core.validators.RegexValidator(regex=b'^[a-zA-Z_][0-9a-zA-Z_]*$', message="Code can only contain the letters a-z, A-Z, digits, and underscores, and can't start with a digit"), oscar.core.validators.non_python_keyword]),
            preserve_default=True,
        ),

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
slav0niccommented, Mar 3, 2016

This migrations break django 1.8/py3 makemigrations:

./manage.py makemigrations
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/mnt/data2/work/graymalin/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/mnt/data2/work/graymalin/lib/python3.4/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/mnt/data2/work/graymalin/lib/python3.4/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/mnt/data2/work/graymalin/lib/python3.4/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/mnt/data2/work/graymalin/lib/python3.4/site-packages/django/core/management/commands/makemigrations.py", line 125, in handle
    migration_name=self.migration_name,
  File "/mnt/data2/work/graymalin/lib/python3.4/site-packages/django/db/migrations/autodetector.py", line 43, in changes
    changes = self._detect_changes(convert_apps, graph)
  File "/mnt/data2/work/graymalin/lib/python3.4/site-packages/django/db/migrations/autodetector.py", line 186, in _detect_changes
    self.generate_altered_fields()
  File "/mnt/data2/work/graymalin/lib/python3.4/site-packages/django/db/migrations/autodetector.py", line 850, in generate_altered_fields
    if old_field_dec != new_field_dec:
  File "/mnt/data2/work/graymalin/lib/python3.4/site-packages/django/core/validators.py", line 55, in __eq__
    self.regex.pattern == other.regex.pattern and
AttributeError: 'bytes' object has no attribute 'pattern'

problem in regex bytes, without b it’s work fine https://botbot.me/freenode/django-oscar/2016-03-03/?msg=61450113&page=1

0reactions
mvantellingencommented, Jul 13, 2016

Should be fixed in 1.2.2 / master

Read more comments on GitHub >

github_iconTop Results From Across the Web

Django Heroku Error "Your models have changes that are not ...
Running migrations: No migrations to apply. Your models have changes that are not yet reflected in a migration, and so won't be applied....
Read more >
Issue - Your models in app(s) (...) have changes that are not ...
Hi,. I recently upgraded from Django 2 to Django 3.2. Everything works fine but when I execute “migrate” as a manage.py command, ...
Read more >
have changes that are not yet reflected in a migration, and so ...
Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new ......
Read more >
Bug #1895037 “Your models have changes that are not yet ...
Your models have changes that are not yet reflected in a migration, and so won 't be applied.
Read more >
Making Django migrations in Python - LogRocket Blog
Simply define your data models, migrate your changes, and you're good ... 'rockets' have changes that are not yet reflected in a migration, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found