ubernostrum / django-soapbox

A Django application for announcing things

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Needs new migrations in Python 3

peterbe opened this issue · comments

Running ./manage.py makemigrations will try to create /tmp/testenv/lib/python3.7/site-packages/soapbox/migrations/0003_auto_20191023_1328.py (using Django 1.11.23):

# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-10-23 13:28
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('soapbox', '0002_is_global_default'),
    ]

    operations = [
        migrations.AlterField(
            model_name='message',
            name='is_active',
            field=models.BooleanField(default=True, help_text='Only active messages will be displayed.'),
        ),
        migrations.AlterField(
            model_name='message',
            name='is_global',
            field=models.BooleanField(default=False, help_text='If checked, this message will display on all pages.'),
        ),
        migrations.AlterField(
            model_name='message',
            name='url',
            field=models.CharField(blank=True, help_text='Message will be displayed on any URL which matches this.', max_length=255, null=True, verbose_name='URL'),
        ),
    ]

Not sure what the exact reasons are for why this happens.

My use case is upgrading github.com/mdn/kuma from Python 2.7 to Python 3.7 and it's on Django 1.11.23.

Perhaps I just don't know how to use this, but if I put in

MIGRATION_MODULES = {
    'soapbox': 'proj.soap_migrations'
}

in settings.py it now doesn't need to make any migrations.

▶ ./manage.py makemigrations --dry-run
Migrations for 'soapbox':
  /private/tmp/testenv/lib/python3.7/site-packages/soapbox/migrations/0003_auto_20191023_1346.py
    - Alter field is_active on message
    - Alter field is_global on message
    - Alter field url on message

▶ jed proj2/settings.py

▶ ./manage.py makemigrations --dry-run
No changes detected

▶ ls -l /private/tmp/testenv/lib/python3.7/site-packages/soapbox/migrations
total 16
-rw-r--r--  1 peterbe  wheel  1392 Oct 23 09:27 0001_initial.py
-rw-r--r--  1 peterbe  wheel   530 Oct 23 09:27 0002_is_global_default.py
-rw-r--r--  1 peterbe  wheel     0 Oct 23 09:27 __init__.py
drwxr-xr-x  5 peterbe  wheel   160 Oct 23 09:27 __pycache__

Never mind that last comment. There was an error that got supressed that was caused by a typo on my behalf.
I had

MIGRATION_MODULES = {
    'soapbox': 'proj.soap_migrations'
}

but proj didn't exist as a module.

I'm no longer blocked.