diff --git a/CHANGES.txt b/CHANGES.txt index dbd8d18..59621d8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,7 +1,7 @@ Changes ======= -4.4.1 (2018-10-18) +4.4.1 (2018-10-24) ------------------ - Add a German translation @@ -16,6 +16,9 @@ Changes - pin prospector to 0.12.11, and pin astroid to 1.6.5 [hsiaoyi0504] +- fix missing migration and add check to prevent it happening again. + [markddavidoff] + 4.4.0 (2018-05-26) ------------------ diff --git a/axes/migrations/0004_auto_20181024_1538.py b/axes/migrations/0004_auto_20181024_1538.py new file mode 100644 index 0000000..266f5d0 --- /dev/null +++ b/axes/migrations/0004_auto_20181024_1538.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.16 on 2018-10-24 22:38 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('axes', '0003_auto_20160322_0929'), + ] + + operations = [ + migrations.AlterModelOptions( + name='accessattempt', + options={'verbose_name': 'access attempt', 'verbose_name_plural': 'access attempts'}, + ), + migrations.AlterModelOptions( + name='accesslog', + options={'verbose_name': 'access log', 'verbose_name_plural': 'access logs'}, + ), + migrations.AlterField( + model_name='accessattempt', + name='attempt_time', + field=models.DateTimeField(auto_now_add=True, verbose_name='Attempt Time'), + ), + migrations.AlterField( + model_name='accessattempt', + name='user_agent', + field=models.CharField(db_index=True, max_length=255, verbose_name='User Agent'), + ), + migrations.AlterField( + model_name='accessattempt', + name='username', + field=models.CharField(db_index=True, max_length=255, null=True, verbose_name='Username'), + ), + migrations.AlterField( + model_name='accesslog', + name='attempt_time', + field=models.DateTimeField(auto_now_add=True, verbose_name='Attempt Time'), + ), + migrations.AlterField( + model_name='accesslog', + name='logout_time', + field=models.DateTimeField(blank=True, null=True, verbose_name='Logout Time'), + ), + migrations.AlterField( + model_name='accesslog', + name='user_agent', + field=models.CharField(db_index=True, max_length=255, verbose_name='User Agent'), + ), + migrations.AlterField( + model_name='accesslog', + name='username', + field=models.CharField(db_index=True, max_length=255, null=True, verbose_name='Username'), + ), + ] diff --git a/axes/tests/test_models.py b/axes/tests/test_models.py new file mode 100644 index 0000000..7d6df4f --- /dev/null +++ b/axes/tests/test_models.py @@ -0,0 +1,27 @@ +from django.test import TestCase + + +class MigrationsCheck(TestCase): + def setUp(self): + from django.utils import translation + self.saved_locale = translation.get_language() + translation.deactivate_all() + + def tearDown(self): + if self.saved_locale is not None: + from django.utils import translation + translation.activate(self.saved_locale) + + def test_missing_migrations(self): + from django.db import connection + from django.apps.registry import apps + from django.db.migrations.executor import MigrationExecutor + executor = MigrationExecutor(connection) + from django.db.migrations.autodetector import MigrationAutodetector + from django.db.migrations.state import ProjectState + autodetector = MigrationAutodetector( + executor.loader.project_state(), + ProjectState.from_apps(apps), + ) + changes = autodetector.changes(graph=executor.loader.graph) + self.assertEqual({}, changes) diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..154db24 --- /dev/null +++ b/manage.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "axes.test_settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv)