Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 0001_initial.py for migration bug fix #3489

Merged
merged 3 commits into from
Oct 20, 2023

Conversation

elementzonline
Copy link
Contributor

Submitting Pull Requests for fixing bug for the issue #3488

@coveralls
Copy link

coveralls commented Oct 18, 2023

Coverage Status

coverage: 91.702%. remained the same when pulling aa043e8 on elementzonline:main into b58170f on pennersr:main.

@@ -12,6 +12,7 @@ class Migration(migrations.Migration):
dependencies = (
[
("sites", "0001_initial"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
if app_settings.SITES_ENABLED
else []
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct. The user model is always a dependency, and the site model conditionally is. So, the original code is almost correct except for missing some brackets:

    dependencies = (
        [
            ("sites", "0001_initial"),
        ]
        if app_settings.SITES_ENABLED
        else []
    ) + [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

Updated the migrations to fix issue with not selecting user model dependency, modified as per the suggesion from pennersr
removed unwanted line
@elementzonline
Copy link
Contributor Author

Hi,
updated the migrations file as noted. It also fixed the issue #3488

@pennersr pennersr merged commit b9ad587 into pennersr:main Oct 20, 2023
23 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants