We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Fix fk issues in 2.6 migration/setup
seems like (at least for some users) there is foreign key constraints that are not removed during migration.

we probably need to add something here https://github.com/translate/pootle/blob/stable/2.6.2/pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py

specifically, to remove fk constraints to this table on unit commented_by/submitted_by

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pootle/apps/pootle_app/management/commands/setup.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # Copyright 2013, 2014 Zuza Software Foundation
5 #
6 # This file is part of Pootle.
7 #
8 # Pootle is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
11 # version.
12 #
13 # Pootle is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License along with
18 # Pootle; if not, see <http://www.gnu.org/licenses/>.
19 
20 import logging
21 import os
22 
23 # This must be run before importing Django.
24 os.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'
25 
26 from django.core.management import call_command
27 from django.core.management.base import CommandError, NoArgsCommand
28 
29 from pootle.__version__ import build as NEW_POOTLE_BUILD
30 from pootle_app.models.pootle_config import get_pootle_build
31 
32 
33 class Command(NoArgsCommand):
34     help = 'Runs the install/upgrade machinery.'
35 
36     def handle_noargs(self, **options):
37         """Run the install or upgrade machinery.
38 
39         If there is an up-to-date Pootle setup then no action is performed.
40         """
41         current_buildversion = get_pootle_build()
42 
43         if not current_buildversion:
44             raise CommandError('Pootle 2.6.1 is not meant to be used in real '
45                                'world deployments.'
46                                '\n\n'
47                                'If you want to install a fresh Pootle then '
48                                'install Pootle 2.7.0 or later.'
49                                '\n\n'
50                                'Otherwise you are upgrading Pootle and you '
51                                'already have have upgraded up to the 2.6.1 '
52                                'stage, so you must now proceed now with the '
53                                'final upgrade to Pootle 2.7.0 or later.')
54         elif current_buildversion < 22000:
55             # Trying to upgrade a deployment older than Pootle 2.5.0 for which
56             # we don't provide a direct upgrade.
57             raise CommandError('This Pootle installation is too old. Please '
58                                'upgrade first to 2.5.1.3 before upgrading to '
59                                'this version.')
60         elif current_buildversion < NEW_POOTLE_BUILD:
61             logging.info('Upgrading existing Pootle installation.')
62 
63             call_command('syncdb', interactive=False)
64 
65             if current_buildversion < 25100:
66                 # We are upgrading from a pre-South installation (before Pootle
67                 # 2.5.1), so it is necessary to fake the first migration for
68                 # some apps.
69                 OLD_APPS = ("pootle_app", "pootle_language",
70                             "pootle_notifications", "pootle_project",
71                             "pootle_statistics", "pootle_store",
72                             "pootle_translationproject", "staticpages")
73 
74                 for app in OLD_APPS:
75                     call_command("migrate", app, "0001", fake=True, interactive=False)
76 
77             call_command('migrate', interactive=False)
78             call_command('upgrade')
79 
80             logging.warning('\n\n\n    Warning: Pootle 2.6.1 is an interim '
81                             'release (a migration step to Pootle'
82                             '\n             2.7.0). Do not use Pootle 2.6.1 '
83                             'for any deployment.\n\n')
84
```

Path: `pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 from south.utils import datetime_utils as datetime
3 from south.db import db
4 from south.v2 import SchemaMigration
5 from django.db import connection
6 
7 
8 class Migration(SchemaMigration):
9     depends_on = (
10         ("pootle_tagging", "0003_del_tag__del_taggeditem"),
11     )
12 
13     no_dry_run = True
14 
15     def forwards(self, orm):
16         # Deleting remnants of model 'PootleProfile'
17         if u'pootle_app_pootleprofile' in connection.introspection.table_names():
18             db.delete_table(u'pootle_app_pootleprofile')
19 
20 
21     def backwards(self, orm):
22         raise RuntimeError("Cannot reverse this migration.")
23 
24     models = {
25         u'accounts.user': {
26             'Meta': {'object_name': 'User'},
27             '_unit_rows': ('django.db.models.fields.SmallIntegerField', [], {'default': '9', 'db_column': "'unit_rows'"}),
28             'alt_src_langs': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'user_alt_src_langs'", 'blank': 'True', 'db_index': 'True', 'to': u"orm['pootle_language.Language']"}),
29             'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
30             'email': ('django.db.models.fields.EmailField', [], {'max_length': '255'}),
31             'full_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
32             'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
33             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
34             'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
35             'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
36             'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
37             'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
38             'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
39             'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
40         },
41         u'auth.group': {
42             'Meta': {'object_name': 'Group'},
43             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
44             'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
45             'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
46         },
47         u'auth.permission': {
48             'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
49             'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
50             'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
51             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
52             'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
53         },
54         u'contenttypes.contenttype': {
55             'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
56             'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
57             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
58             'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
59             'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
60         },
61         'pootle_app.directory': {
62             'Meta': {'ordering': "['name']", 'object_name': 'Directory'},
63             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
64             'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
65             'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'child_dirs'", 'null': 'True', 'to': "orm['pootle_app.Directory']"}),
66             'pootle_path': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})
67         },
68         u'pootle_language.language': {
69             'Meta': {'ordering': "['code']", 'object_name': 'Language', 'db_table': "'pootle_app_language'"},
70             'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}),
71             'description': ('pootle.core.markup.fields.MarkupField', [], {'blank': 'True'}),
72             'directory': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['pootle_app.Directory']", 'unique': 'True'}),
73             'fullname': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
74             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
75             'nplurals': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),
76             'pluralequation': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
77             'specialchars': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})
78         }
79     }
80 
81     complete_apps = ['accounts']
82
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py b/pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py
--- a/pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py
+++ b/pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py
@@ -14,6 +14,9 @@
 
     def forwards(self, orm):
         # Deleting remnants of model 'PootleProfile'
+        db.delete_foreign_key('pootle_store_unit', 'commented_by_id')
+        db.delete_foreign_key('pootle_store_unit', 'submitted_by_id')
+        db.delete_foreign_key('pootle_app_submission', 'submitter_id')
         if u'pootle_app_pootleprofile' in connection.introspection.table_names():
             db.delete_table(u'pootle_app_pootleprofile')
 
diff --git a/pootle/apps/pootle_app/management/commands/setup.py b/pootle/apps/pootle_app/management/commands/setup.py
--- a/pootle/apps/pootle_app/management/commands/setup.py
+++ b/pootle/apps/pootle_app/management/commands/setup.py
@@ -26,7 +26,8 @@
 from django.core.management import call_command
 from django.core.management.base import CommandError, NoArgsCommand
 
-from pootle.__version__ import build as NEW_POOTLE_BUILD
+from pootle.__version__ import (build as NEW_POOTLE_BUILD,
+                                sver as pootle_version)
 from pootle_app.models.pootle_config import get_pootle_build
 
 
@@ -41,16 +42,17 @@
         current_buildversion = get_pootle_build()
 
         if not current_buildversion:
-            raise CommandError('Pootle 2.6.1 is not meant to be used in real '
+            raise CommandError('Pootle %s is not meant to be used in real '
                                'world deployments.'
                                '\n\n'
                                'If you want to install a fresh Pootle then '
                                'install Pootle 2.7.0 or later.'
                                '\n\n'
                                'Otherwise you are upgrading Pootle and you '
-                               'already have have upgraded up to the 2.6.1 '
+                               'already have have upgraded up to the %s '
                                'stage, so you must now proceed now with the '
-                               'final upgrade to Pootle 2.7.0 or later.')
+                               'final upgrade to Pootle 2.7.0 or later.' %
+                               (pootle_version, pootle_version))
         elif current_buildversion < 22000:
             # Trying to upgrade a deployment older than Pootle 2.5.0 for which
             # we don't provide a direct upgrade.
@@ -72,12 +74,14 @@
                             "pootle_translationproject", "staticpages")
 
                 for app in OLD_APPS:
-                    call_command("migrate", app, "0001", fake=True, interactive=False)
+                    call_command("migrate", app, "0001", fake=True,
+                                 interactive=False)
 
             call_command('migrate', interactive=False)
             call_command('upgrade')
 
-            logging.warning('\n\n\n    Warning: Pootle 2.6.1 is an interim '
+            logging.warning('\n\n\n    Warning: Pootle %s is an interim '
                             'release (a migration step to Pootle'
-                            '\n             2.7.0). Do not use Pootle 2.6.1 '
-                            'for any deployment.\n\n')
+                            '\n             2.7.0). Do not use Pootle %s '
+                            'for any deployment.\n\n' %
+                            (pootle_version, pootle_version))

{"golden_diff": "diff --git a/pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py b/pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py\n--- a/pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py\n+++ b/pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py\n@@ -14,6 +14,9 @@\n \n     def forwards(self, orm):\n         # Deleting remnants of model 'PootleProfile'\n+        db.delete_foreign_key('pootle_store_unit', 'commented_by_id')\n+        db.delete_foreign_key('pootle_store_unit', 'submitted_by_id')\n+        db.delete_foreign_key('pootle_app_submission', 'submitter_id')\n         if u'pootle_app_pootleprofile' in connection.introspection.table_names():\n             db.delete_table(u'pootle_app_pootleprofile')\n \ndiff --git a/pootle/apps/pootle_app/management/commands/setup.py b/pootle/apps/pootle_app/management/commands/setup.py\n--- a/pootle/apps/pootle_app/management/commands/setup.py\n+++ b/pootle/apps/pootle_app/management/commands/setup.py\n@@ -26,7 +26,8 @@\n from django.core.management import call_command\n from django.core.management.base import CommandError, NoArgsCommand\n \n-from pootle.__version__ import build as NEW_POOTLE_BUILD\n+from pootle.__version__ import (build as NEW_POOTLE_BUILD,\n+                                sver as pootle_version)\n from pootle_app.models.pootle_config import get_pootle_build\n \n \n@@ -41,16 +42,17 @@\n         current_buildversion = get_pootle_build()\n \n         if not current_buildversion:\n-            raise CommandError('Pootle 2.6.1 is not meant to be used in real '\n+            raise CommandError('Pootle %s is not meant to be used in real '\n                                'world deployments.'\n                                '\\n\\n'\n                                'If you want to install a fresh Pootle then '\n                                'install Pootle 2.7.0 or later.'\n                                '\\n\\n'\n                                'Otherwise you are upgrading Pootle and you '\n-                               'already have have upgraded up to the 2.6.1 '\n+                               'already have have upgraded up to the %s '\n                                'stage, so you must now proceed now with the '\n-                               'final upgrade to Pootle 2.7.0 or later.')\n+                               'final upgrade to Pootle 2.7.0 or later.' %\n+                               (pootle_version, pootle_version))\n         elif current_buildversion < 22000:\n             # Trying to upgrade a deployment older than Pootle 2.5.0 for which\n             # we don't provide a direct upgrade.\n@@ -72,12 +74,14 @@\n                             \"pootle_translationproject\", \"staticpages\")\n \n                 for app in OLD_APPS:\n-                    call_command(\"migrate\", app, \"0001\", fake=True, interactive=False)\n+                    call_command(\"migrate\", app, \"0001\", fake=True,\n+                                 interactive=False)\n \n             call_command('migrate', interactive=False)\n             call_command('upgrade')\n \n-            logging.warning('\\n\\n\\n    Warning: Pootle 2.6.1 is an interim '\n+            logging.warning('\\n\\n\\n    Warning: Pootle %s is an interim '\n                             'release (a migration step to Pootle'\n-                            '\\n             2.7.0). Do not use Pootle 2.6.1 '\n-                            'for any deployment.\\n\\n')\n+                            '\\n             2.7.0). Do not use Pootle %s '\n+                            'for any deployment.\\n\\n' %\n+                            (pootle_version, pootle_version))\n", "issue": "Fix fk issues in 2.6 migration/setup\nseems like (at least for some users) there is foreign key constraints that are not removed during migration.\r\n\r\nwe probably need to add something here https://github.com/translate/pootle/blob/stable/2.6.2/pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py\r\n\r\nspecifically, to remove fk constraints to this table on unit commented_by/submitted_by\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright 2013, 2014 Zuza Software Foundation\n#\n# This file is part of Pootle.\n#\n# Pootle is free software; you can redistribute it and/or modify it under the\n# terms of the GNU General Public License as published by the Free Software\n# Foundation; either version 2 of the License, or (at your option) any later\n# version.\n#\n# Pootle is distributed in the hope that it will be useful, but WITHOUT ANY\n# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n# A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License along with\n# Pootle; if not, see <http://www.gnu.org/licenses/>.\n\nimport logging\nimport os\n\n# This must be run before importing Django.\nos.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'\n\nfrom django.core.management import call_command\nfrom django.core.management.base import CommandError, NoArgsCommand\n\nfrom pootle.__version__ import build as NEW_POOTLE_BUILD\nfrom pootle_app.models.pootle_config import get_pootle_build\n\n\nclass Command(NoArgsCommand):\n    help = 'Runs the install/upgrade machinery.'\n\n    def handle_noargs(self, **options):\n        \"\"\"Run the install or upgrade machinery.\n\n        If there is an up-to-date Pootle setup then no action is performed.\n        \"\"\"\n        current_buildversion = get_pootle_build()\n\n        if not current_buildversion:\n            raise CommandError('Pootle 2.6.1 is not meant to be used in real '\n                               'world deployments.'\n                               '\\n\\n'\n                               'If you want to install a fresh Pootle then '\n                               'install Pootle 2.7.0 or later.'\n                               '\\n\\n'\n                               'Otherwise you are upgrading Pootle and you '\n                               'already have have upgraded up to the 2.6.1 '\n                               'stage, so you must now proceed now with the '\n                               'final upgrade to Pootle 2.7.0 or later.')\n        elif current_buildversion < 22000:\n            # Trying to upgrade a deployment older than Pootle 2.5.0 for which\n            # we don't provide a direct upgrade.\n            raise CommandError('This Pootle installation is too old. Please '\n                               'upgrade first to 2.5.1.3 before upgrading to '\n                               'this version.')\n        elif current_buildversion < NEW_POOTLE_BUILD:\n            logging.info('Upgrading existing Pootle installation.')\n\n            call_command('syncdb', interactive=False)\n\n            if current_buildversion < 25100:\n                # We are upgrading from a pre-South installation (before Pootle\n                # 2.5.1), so it is necessary to fake the first migration for\n                # some apps.\n                OLD_APPS = (\"pootle_app\", \"pootle_language\",\n                            \"pootle_notifications\", \"pootle_project\",\n                            \"pootle_statistics\", \"pootle_store\",\n                            \"pootle_translationproject\", \"staticpages\")\n\n                for app in OLD_APPS:\n                    call_command(\"migrate\", app, \"0001\", fake=True, interactive=False)\n\n            call_command('migrate', interactive=False)\n            call_command('upgrade')\n\n            logging.warning('\\n\\n\\n    Warning: Pootle 2.6.1 is an interim '\n                            'release (a migration step to Pootle'\n                            '\\n             2.7.0). Do not use Pootle 2.6.1 '\n                            'for any deployment.\\n\\n')\n", "path": "pootle/apps/pootle_app/management/commands/setup.py"}, {"content": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import connection\n\n\nclass Migration(SchemaMigration):\n    depends_on = (\n        (\"pootle_tagging\", \"0003_del_tag__del_taggeditem\"),\n    )\n\n    no_dry_run = True\n\n    def forwards(self, orm):\n        # Deleting remnants of model 'PootleProfile'\n        if u'pootle_app_pootleprofile' in connection.introspection.table_names():\n            db.delete_table(u'pootle_app_pootleprofile')\n\n\n    def backwards(self, orm):\n        raise RuntimeError(\"Cannot reverse this migration.\")\n\n    models = {\n        u'accounts.user': {\n            'Meta': {'object_name': 'User'},\n            '_unit_rows': ('django.db.models.fields.SmallIntegerField', [], {'default': '9', 'db_column': \"'unit_rows'\"}),\n            'alt_src_langs': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"'user_alt_src_langs'\", 'blank': 'True', 'db_index': 'True', 'to': u\"orm['pootle_language.Language']\"}),\n            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n            'email': ('django.db.models.fields.EmailField', [], {'max_length': '255'}),\n            'full_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Group']\"}),\n            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Permission']\"}),\n            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n        },\n        u'auth.group': {\n            'Meta': {'object_name': 'Group'},\n            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),\n            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n        },\n        u'auth.permission': {\n            'Meta': {'ordering': \"(u'content_type__app_label', u'content_type__model', u'codename')\", 'unique_together': \"((u'content_type', u'codename'),)\", 'object_name': 'Permission'},\n            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['contenttypes.ContentType']\"}),\n            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n        },\n        u'contenttypes.contenttype': {\n            'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n        },\n        'pootle_app.directory': {\n            'Meta': {'ordering': \"['name']\", 'object_name': 'Directory'},\n            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'child_dirs'\", 'null': 'True', 'to': \"orm['pootle_app.Directory']\"}),\n            'pootle_path': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})\n        },\n        u'pootle_language.language': {\n            'Meta': {'ordering': \"['code']\", 'object_name': 'Language', 'db_table': \"'pootle_app_language'\"},\n            'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}),\n            'description': ('pootle.core.markup.fields.MarkupField', [], {'blank': 'True'}),\n            'directory': ('django.db.models.fields.related.OneToOneField', [], {'to': \"orm['pootle_app.Directory']\", 'unique': 'True'}),\n            'fullname': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n            'nplurals': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),\n            'pluralequation': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n            'specialchars': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})\n        }\n    }\n\n    complete_apps = ['accounts']\n", "path": "pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright 2013, 2014 Zuza Software Foundation\n#\n# This file is part of Pootle.\n#\n# Pootle is free software; you can redistribute it and/or modify it under the\n# terms of the GNU General Public License as published by the Free Software\n# Foundation; either version 2 of the License, or (at your option) any later\n# version.\n#\n# Pootle is distributed in the hope that it will be useful, but WITHOUT ANY\n# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n# A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License along with\n# Pootle; if not, see <http://www.gnu.org/licenses/>.\n\nimport logging\nimport os\n\n# This must be run before importing Django.\nos.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'\n\nfrom django.core.management import call_command\nfrom django.core.management.base import CommandError, NoArgsCommand\n\nfrom pootle.__version__ import (build as NEW_POOTLE_BUILD,\n                                sver as pootle_version)\nfrom pootle_app.models.pootle_config import get_pootle_build\n\n\nclass Command(NoArgsCommand):\n    help = 'Runs the install/upgrade machinery.'\n\n    def handle_noargs(self, **options):\n        \"\"\"Run the install or upgrade machinery.\n\n        If there is an up-to-date Pootle setup then no action is performed.\n        \"\"\"\n        current_buildversion = get_pootle_build()\n\n        if not current_buildversion:\n            raise CommandError('Pootle %s is not meant to be used in real '\n                               'world deployments.'\n                               '\\n\\n'\n                               'If you want to install a fresh Pootle then '\n                               'install Pootle 2.7.0 or later.'\n                               '\\n\\n'\n                               'Otherwise you are upgrading Pootle and you '\n                               'already have have upgraded up to the %s '\n                               'stage, so you must now proceed now with the '\n                               'final upgrade to Pootle 2.7.0 or later.' %\n                               (pootle_version, pootle_version))\n        elif current_buildversion < 22000:\n            # Trying to upgrade a deployment older than Pootle 2.5.0 for which\n            # we don't provide a direct upgrade.\n            raise CommandError('This Pootle installation is too old. Please '\n                               'upgrade first to 2.5.1.3 before upgrading to '\n                               'this version.')\n        elif current_buildversion < NEW_POOTLE_BUILD:\n            logging.info('Upgrading existing Pootle installation.')\n\n            call_command('syncdb', interactive=False)\n\n            if current_buildversion < 25100:\n                # We are upgrading from a pre-South installation (before Pootle\n                # 2.5.1), so it is necessary to fake the first migration for\n                # some apps.\n                OLD_APPS = (\"pootle_app\", \"pootle_language\",\n                            \"pootle_notifications\", \"pootle_project\",\n                            \"pootle_statistics\", \"pootle_store\",\n                            \"pootle_translationproject\", \"staticpages\")\n\n                for app in OLD_APPS:\n                    call_command(\"migrate\", app, \"0001\", fake=True,\n                                 interactive=False)\n\n            call_command('migrate', interactive=False)\n            call_command('upgrade')\n\n            logging.warning('\\n\\n\\n    Warning: Pootle %s is an interim '\n                            'release (a migration step to Pootle'\n                            '\\n             2.7.0). Do not use Pootle %s '\n                            'for any deployment.\\n\\n' %\n                            (pootle_version, pootle_version))\n", "path": "pootle/apps/pootle_app/management/commands/setup.py"}, {"content": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import connection\n\n\nclass Migration(SchemaMigration):\n    depends_on = (\n        (\"pootle_tagging\", \"0003_del_tag__del_taggeditem\"),\n    )\n\n    no_dry_run = True\n\n    def forwards(self, orm):\n        # Deleting remnants of model 'PootleProfile'\n        db.delete_foreign_key('pootle_store_unit', 'commented_by_id')\n        db.delete_foreign_key('pootle_store_unit', 'submitted_by_id')\n        db.delete_foreign_key('pootle_app_submission', 'submitter_id')\n        if u'pootle_app_pootleprofile' in connection.introspection.table_names():\n            db.delete_table(u'pootle_app_pootleprofile')\n\n\n    def backwards(self, orm):\n        raise RuntimeError(\"Cannot reverse this migration.\")\n\n    models = {\n        u'accounts.user': {\n            'Meta': {'object_name': 'User'},\n            '_unit_rows': ('django.db.models.fields.SmallIntegerField', [], {'default': '9', 'db_column': \"'unit_rows'\"}),\n            'alt_src_langs': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"'user_alt_src_langs'\", 'blank': 'True', 'db_index': 'True', 'to': u\"orm['pootle_language.Language']\"}),\n            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n            'email': ('django.db.models.fields.EmailField', [], {'max_length': '255'}),\n            'full_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Group']\"}),\n            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Permission']\"}),\n            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n        },\n        u'auth.group': {\n            'Meta': {'object_name': 'Group'},\n            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),\n            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n        },\n        u'auth.permission': {\n            'Meta': {'ordering': \"(u'content_type__app_label', u'content_type__model', u'codename')\", 'unique_together': \"((u'content_type', u'codename'),)\", 'object_name': 'Permission'},\n            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['contenttypes.ContentType']\"}),\n            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n        },\n        u'contenttypes.contenttype': {\n            'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n        },\n        'pootle_app.directory': {\n            'Meta': {'ordering': \"['name']\", 'object_name': 'Directory'},\n            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'child_dirs'\", 'null': 'True', 'to': \"orm['pootle_app.Directory']\"}),\n            'pootle_path': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})\n        },\n        u'pootle_language.language': {\n            'Meta': {'ordering': \"['code']\", 'object_name': 'Language', 'db_table': \"'pootle_app_language'\"},\n            'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}),\n            'description': ('pootle.core.markup.fields.MarkupField', [], {'blank': 'True'}),\n            'directory': ('django.db.models.fields.related.OneToOneField', [], {'to': \"orm['pootle_app.Directory']\", 'unique': 'True'}),\n            'fullname': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n            'nplurals': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),\n            'pluralequation': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n            'specialchars': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})\n        }\n    }\n\n    complete_apps = ['accounts']\n", "path": "pootle/apps/accounts/migrations/0005_drop_pootle_app_pootleprofile.py"}]}