We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Running migrate twice gives an error about changed models
If you run `migrate` a second time directly after an initial migration you will get 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.
```

`makemigrations` produces this file:

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

from django.db import models, migrations
import pootle.core.markup.fields


class Migration(migrations.Migration):

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

    operations = [
        migrations.AlterField(
            model_name='virtualfolder',
            name='description',
            field=pootle.core.markup.fields.MarkupField(help_text='Use this to provide more information or instructions. Allowed markup: HTML', verbose_name='Description', blank=True),
            preserve_default=True,
        ),
    ]
```

@unho Why are virtualfolders doing this?


--- 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/virtualfolder/migrations/0001_initial.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
3 
4 from django.db import models, migrations
5 import pootle.core.markup.fields
6 
7 
8 class Migration(migrations.Migration):
9 
10     dependencies = [
11         ('pootle_store', '0001_initial'),
12     ]
13 
14     operations = [
15         migrations.CreateModel(
16             name='VirtualFolder',
17             fields=[
18                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
19                 ('name', models.CharField(max_length=70, verbose_name='Name')),
20                 ('location', models.CharField(help_text='Root path where this virtual folder is applied.', max_length=255, verbose_name='Location')),
21                 ('filter_rules', models.TextField(help_text='Filtering rules that tell which stores this virtual folder comprises.', verbose_name='Filter')),
22                 ('priority', models.FloatField(default=1, help_text='Number specifying importance. Greater priority means it is more important.', verbose_name='Priority')),
23                 ('is_browsable', models.BooleanField(default=True, help_text='Whether this virtual folder is active or not.', verbose_name='Is browsable?')),
24                 ('description', pootle.core.markup.fields.MarkupField(help_text='Use this to provide more information or instructions. Allowed markup: HTML', verbose_name='Description', blank=True)),
25                 ('units', models.ManyToManyField(related_name='vfolders', to='pootle_store.Unit', db_index=True)),
26             ],
27             options={
28                 'ordering': ['-priority', 'name'],
29             },
30             bases=(models.Model,),
31         ),
32         migrations.AlterUniqueTogether(
33             name='virtualfolder',
34             unique_together=set([('name', 'location')]),
35         ),
36     ]
37
```

Path: `pootle/core/markup/fields.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # Copyright (C) Pootle contributors.
5 #
6 # This file is a part of the Pootle project. It is distributed under the GPL3
7 # or later license. See the LICENSE file for a copy of the license and the
8 # AUTHORS file for copyright and authorship information.
9 
10 import logging
11 
12 from django.conf import settings
13 from django.core.cache import cache
14 from django.db import models
15 from django.utils.safestring import mark_safe
16 
17 from .filters import apply_markup_filter
18 from .widgets import MarkupTextarea
19 
20 
21 __all__ = ('Markup', 'MarkupField',)
22 
23 
24 logger = logging.getLogger('pootle.markup')
25 
26 
27 _rendered_cache_key = lambda obj, pk, field: '_%s_%s_%s_rendered' % \
28         (obj, pk, field)
29 
30 
31 class Markup(object):
32 
33     def __init__(self, instance, field_name, rendered_cache_key):
34         self.instance = instance
35         self.field_name = field_name
36         self.cache_key = rendered_cache_key
37 
38     @property
39     def raw(self):
40         return self.instance.__dict__[self.field_name]
41 
42     @raw.setter
43     def raw(self, value):
44         setattr(self.instance, self.field_name, value)
45 
46     @property
47     def rendered(self):
48         rendered = cache.get(self.cache_key)
49 
50         if not rendered:
51             logger.debug(u'Caching rendered output of %r', self.cache_key)
52             rendered = apply_markup_filter(self.raw)
53             cache.set(self.cache_key, rendered,
54                       settings.OBJECT_CACHE_TIMEOUT)
55 
56         return rendered
57 
58     def __unicode__(self):
59         return mark_safe(self.rendered)
60 
61     def __nonzero__(self):
62         return self.raw.strip() != '' and self.raw is not None
63 
64 
65 class MarkupDescriptor(object):
66 
67     def __init__(self, field):
68         self.field = field
69 
70     def __get__(self, obj, owner):
71         if obj is None:
72             raise AttributeError('Can only be accessed via an instance.')
73 
74         markup = obj.__dict__[self.field.name]
75         if markup is None:
76             return None
77 
78         cache_key = _rendered_cache_key(obj.__class__.__name__,
79                                         obj.pk,
80                                         self.field.name)
81         return Markup(obj, self.field.name, cache_key)
82 
83     def __set__(self, obj, value):
84         if isinstance(value, Markup):
85             obj.__dict__[self.field.name] = value.raw
86         else:
87             obj.__dict__[self.field.name] = value
88 
89 
90 class MarkupField(models.TextField):
91 
92     description = 'Text field supporting different markup formats.'
93 
94     def contribute_to_class(self, cls, name):
95         super(MarkupField, self).contribute_to_class(cls, name)
96         setattr(cls, self.name, MarkupDescriptor(self))
97 
98     def pre_save(self, model_instance, add):
99         value = super(MarkupField, self).pre_save(model_instance, add)
100 
101         if not add:
102             # Invalidate cache to force rendering upon next retrieval
103             cache_key = _rendered_cache_key(model_instance.__class__.__name__,
104                                             model_instance.pk,
105                                             self.name)
106             logger.debug('Invalidating cache for %r', cache_key)
107             cache.delete(cache_key)
108 
109         return value.raw
110 
111     def get_prep_value(self, value):
112         if isinstance(value, Markup):
113             return value.raw
114 
115         return value
116 
117     def value_to_string(self, obj):
118         value = self._get_val_from_obj(obj)
119         return self.get_prep_value(value)
120 
121     def formfield(self, **kwargs):
122         defaults = {'widget': MarkupTextarea}
123         defaults.update(kwargs)
124         return super(MarkupField, self).formfield(**defaults)
125
```
--- 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/virtualfolder/migrations/0001_initial.py b/pootle/apps/virtualfolder/migrations/0001_initial.py
--- a/pootle/apps/virtualfolder/migrations/0001_initial.py
+++ b/pootle/apps/virtualfolder/migrations/0001_initial.py
@@ -21,7 +21,7 @@
                 ('filter_rules', models.TextField(help_text='Filtering rules that tell which stores this virtual folder comprises.', verbose_name='Filter')),
                 ('priority', models.FloatField(default=1, help_text='Number specifying importance. Greater priority means it is more important.', verbose_name='Priority')),
                 ('is_browsable', models.BooleanField(default=True, help_text='Whether this virtual folder is active or not.', verbose_name='Is browsable?')),
-                ('description', pootle.core.markup.fields.MarkupField(help_text='Use this to provide more information or instructions. Allowed markup: HTML', verbose_name='Description', blank=True)),
+                ('description', pootle.core.markup.fields.MarkupField(verbose_name='Description', blank=True)),
                 ('units', models.ManyToManyField(related_name='vfolders', to='pootle_store.Unit', db_index=True)),
             ],
             options={
diff --git a/pootle/core/markup/fields.py b/pootle/core/markup/fields.py
--- a/pootle/core/markup/fields.py
+++ b/pootle/core/markup/fields.py
@@ -122,3 +122,8 @@
         defaults = {'widget': MarkupTextarea}
         defaults.update(kwargs)
         return super(MarkupField, self).formfield(**defaults)
+
+    def deconstruct(self):
+        name, path, args, kwargs = super(MarkupField, self).deconstruct()
+        kwargs.pop('help_text', None)
+        return name, path, args, kwargs

{"golden_diff": "diff --git a/pootle/apps/virtualfolder/migrations/0001_initial.py b/pootle/apps/virtualfolder/migrations/0001_initial.py\n--- a/pootle/apps/virtualfolder/migrations/0001_initial.py\n+++ b/pootle/apps/virtualfolder/migrations/0001_initial.py\n@@ -21,7 +21,7 @@\n                 ('filter_rules', models.TextField(help_text='Filtering rules that tell which stores this virtual folder comprises.', verbose_name='Filter')),\n                 ('priority', models.FloatField(default=1, help_text='Number specifying importance. Greater priority means it is more important.', verbose_name='Priority')),\n                 ('is_browsable', models.BooleanField(default=True, help_text='Whether this virtual folder is active or not.', verbose_name='Is browsable?')),\n-                ('description', pootle.core.markup.fields.MarkupField(help_text='Use this to provide more information or instructions. Allowed markup: HTML', verbose_name='Description', blank=True)),\n+                ('description', pootle.core.markup.fields.MarkupField(verbose_name='Description', blank=True)),\n                 ('units', models.ManyToManyField(related_name='vfolders', to='pootle_store.Unit', db_index=True)),\n             ],\n             options={\ndiff --git a/pootle/core/markup/fields.py b/pootle/core/markup/fields.py\n--- a/pootle/core/markup/fields.py\n+++ b/pootle/core/markup/fields.py\n@@ -122,3 +122,8 @@\n         defaults = {'widget': MarkupTextarea}\n         defaults.update(kwargs)\n         return super(MarkupField, self).formfield(**defaults)\n+\n+    def deconstruct(self):\n+        name, path, args, kwargs = super(MarkupField, self).deconstruct()\n+        kwargs.pop('help_text', None)\n+        return name, path, args, kwargs\n", "issue": "Running migrate twice gives an error about changed models\nIf you run `migrate` a second time directly after an initial migration you will get the following error.\n\n```\nRunning migrations:\n  No migrations to apply.\n  Your models have changes that are not yet reflected in a migration, and so won't be applied.\n  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.\n```\n\n`makemigrations` produces this file:\n\n``` py\n# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport pootle.core.markup.fields\n\n\nclass Migration(migrations.Migration):\n\n    dependencies = [\n        ('virtualfolder', '0001_initial'),\n    ]\n\n    operations = [\n        migrations.AlterField(\n            model_name='virtualfolder',\n            name='description',\n            field=pootle.core.markup.fields.MarkupField(help_text='Use this to provide more information or instructions. Allowed markup: HTML', verbose_name='Description', blank=True),\n            preserve_default=True,\n        ),\n    ]\n```\n\n@unho Why are virtualfolders doing this?\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport pootle.core.markup.fields\n\n\nclass Migration(migrations.Migration):\n\n    dependencies = [\n        ('pootle_store', '0001_initial'),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name='VirtualFolder',\n            fields=[\n                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),\n                ('name', models.CharField(max_length=70, verbose_name='Name')),\n                ('location', models.CharField(help_text='Root path where this virtual folder is applied.', max_length=255, verbose_name='Location')),\n                ('filter_rules', models.TextField(help_text='Filtering rules that tell which stores this virtual folder comprises.', verbose_name='Filter')),\n                ('priority', models.FloatField(default=1, help_text='Number specifying importance. Greater priority means it is more important.', verbose_name='Priority')),\n                ('is_browsable', models.BooleanField(default=True, help_text='Whether this virtual folder is active or not.', verbose_name='Is browsable?')),\n                ('description', pootle.core.markup.fields.MarkupField(help_text='Use this to provide more information or instructions. Allowed markup: HTML', verbose_name='Description', blank=True)),\n                ('units', models.ManyToManyField(related_name='vfolders', to='pootle_store.Unit', db_index=True)),\n            ],\n            options={\n                'ordering': ['-priority', 'name'],\n            },\n            bases=(models.Model,),\n        ),\n        migrations.AlterUniqueTogether(\n            name='virtualfolder',\n            unique_together=set([('name', 'location')]),\n        ),\n    ]\n", "path": "pootle/apps/virtualfolder/migrations/0001_initial.py"}, {"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nimport logging\n\nfrom django.conf import settings\nfrom django.core.cache import cache\nfrom django.db import models\nfrom django.utils.safestring import mark_safe\n\nfrom .filters import apply_markup_filter\nfrom .widgets import MarkupTextarea\n\n\n__all__ = ('Markup', 'MarkupField',)\n\n\nlogger = logging.getLogger('pootle.markup')\n\n\n_rendered_cache_key = lambda obj, pk, field: '_%s_%s_%s_rendered' % \\\n        (obj, pk, field)\n\n\nclass Markup(object):\n\n    def __init__(self, instance, field_name, rendered_cache_key):\n        self.instance = instance\n        self.field_name = field_name\n        self.cache_key = rendered_cache_key\n\n    @property\n    def raw(self):\n        return self.instance.__dict__[self.field_name]\n\n    @raw.setter\n    def raw(self, value):\n        setattr(self.instance, self.field_name, value)\n\n    @property\n    def rendered(self):\n        rendered = cache.get(self.cache_key)\n\n        if not rendered:\n            logger.debug(u'Caching rendered output of %r', self.cache_key)\n            rendered = apply_markup_filter(self.raw)\n            cache.set(self.cache_key, rendered,\n                      settings.OBJECT_CACHE_TIMEOUT)\n\n        return rendered\n\n    def __unicode__(self):\n        return mark_safe(self.rendered)\n\n    def __nonzero__(self):\n        return self.raw.strip() != '' and self.raw is not None\n\n\nclass MarkupDescriptor(object):\n\n    def __init__(self, field):\n        self.field = field\n\n    def __get__(self, obj, owner):\n        if obj is None:\n            raise AttributeError('Can only be accessed via an instance.')\n\n        markup = obj.__dict__[self.field.name]\n        if markup is None:\n            return None\n\n        cache_key = _rendered_cache_key(obj.__class__.__name__,\n                                        obj.pk,\n                                        self.field.name)\n        return Markup(obj, self.field.name, cache_key)\n\n    def __set__(self, obj, value):\n        if isinstance(value, Markup):\n            obj.__dict__[self.field.name] = value.raw\n        else:\n            obj.__dict__[self.field.name] = value\n\n\nclass MarkupField(models.TextField):\n\n    description = 'Text field supporting different markup formats.'\n\n    def contribute_to_class(self, cls, name):\n        super(MarkupField, self).contribute_to_class(cls, name)\n        setattr(cls, self.name, MarkupDescriptor(self))\n\n    def pre_save(self, model_instance, add):\n        value = super(MarkupField, self).pre_save(model_instance, add)\n\n        if not add:\n            # Invalidate cache to force rendering upon next retrieval\n            cache_key = _rendered_cache_key(model_instance.__class__.__name__,\n                                            model_instance.pk,\n                                            self.name)\n            logger.debug('Invalidating cache for %r', cache_key)\n            cache.delete(cache_key)\n\n        return value.raw\n\n    def get_prep_value(self, value):\n        if isinstance(value, Markup):\n            return value.raw\n\n        return value\n\n    def value_to_string(self, obj):\n        value = self._get_val_from_obj(obj)\n        return self.get_prep_value(value)\n\n    def formfield(self, **kwargs):\n        defaults = {'widget': MarkupTextarea}\n        defaults.update(kwargs)\n        return super(MarkupField, self).formfield(**defaults)\n", "path": "pootle/core/markup/fields.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport pootle.core.markup.fields\n\n\nclass Migration(migrations.Migration):\n\n    dependencies = [\n        ('pootle_store', '0001_initial'),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name='VirtualFolder',\n            fields=[\n                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),\n                ('name', models.CharField(max_length=70, verbose_name='Name')),\n                ('location', models.CharField(help_text='Root path where this virtual folder is applied.', max_length=255, verbose_name='Location')),\n                ('filter_rules', models.TextField(help_text='Filtering rules that tell which stores this virtual folder comprises.', verbose_name='Filter')),\n                ('priority', models.FloatField(default=1, help_text='Number specifying importance. Greater priority means it is more important.', verbose_name='Priority')),\n                ('is_browsable', models.BooleanField(default=True, help_text='Whether this virtual folder is active or not.', verbose_name='Is browsable?')),\n                ('description', pootle.core.markup.fields.MarkupField(verbose_name='Description', blank=True)),\n                ('units', models.ManyToManyField(related_name='vfolders', to='pootle_store.Unit', db_index=True)),\n            ],\n            options={\n                'ordering': ['-priority', 'name'],\n            },\n            bases=(models.Model,),\n        ),\n        migrations.AlterUniqueTogether(\n            name='virtualfolder',\n            unique_together=set([('name', 'location')]),\n        ),\n    ]\n", "path": "pootle/apps/virtualfolder/migrations/0001_initial.py"}, {"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nimport logging\n\nfrom django.conf import settings\nfrom django.core.cache import cache\nfrom django.db import models\nfrom django.utils.safestring import mark_safe\n\nfrom .filters import apply_markup_filter\nfrom .widgets import MarkupTextarea\n\n\n__all__ = ('Markup', 'MarkupField',)\n\n\nlogger = logging.getLogger('pootle.markup')\n\n\n_rendered_cache_key = lambda obj, pk, field: '_%s_%s_%s_rendered' % \\\n        (obj, pk, field)\n\n\nclass Markup(object):\n\n    def __init__(self, instance, field_name, rendered_cache_key):\n        self.instance = instance\n        self.field_name = field_name\n        self.cache_key = rendered_cache_key\n\n    @property\n    def raw(self):\n        return self.instance.__dict__[self.field_name]\n\n    @raw.setter\n    def raw(self, value):\n        setattr(self.instance, self.field_name, value)\n\n    @property\n    def rendered(self):\n        rendered = cache.get(self.cache_key)\n\n        if not rendered:\n            logger.debug(u'Caching rendered output of %r', self.cache_key)\n            rendered = apply_markup_filter(self.raw)\n            cache.set(self.cache_key, rendered,\n                      settings.OBJECT_CACHE_TIMEOUT)\n\n        return rendered\n\n    def __unicode__(self):\n        return mark_safe(self.rendered)\n\n    def __nonzero__(self):\n        return self.raw.strip() != '' and self.raw is not None\n\n\nclass MarkupDescriptor(object):\n\n    def __init__(self, field):\n        self.field = field\n\n    def __get__(self, obj, owner):\n        if obj is None:\n            raise AttributeError('Can only be accessed via an instance.')\n\n        markup = obj.__dict__[self.field.name]\n        if markup is None:\n            return None\n\n        cache_key = _rendered_cache_key(obj.__class__.__name__,\n                                        obj.pk,\n                                        self.field.name)\n        return Markup(obj, self.field.name, cache_key)\n\n    def __set__(self, obj, value):\n        if isinstance(value, Markup):\n            obj.__dict__[self.field.name] = value.raw\n        else:\n            obj.__dict__[self.field.name] = value\n\n\nclass MarkupField(models.TextField):\n\n    description = 'Text field supporting different markup formats.'\n\n    def contribute_to_class(self, cls, name):\n        super(MarkupField, self).contribute_to_class(cls, name)\n        setattr(cls, self.name, MarkupDescriptor(self))\n\n    def pre_save(self, model_instance, add):\n        value = super(MarkupField, self).pre_save(model_instance, add)\n\n        if not add:\n            # Invalidate cache to force rendering upon next retrieval\n            cache_key = _rendered_cache_key(model_instance.__class__.__name__,\n                                            model_instance.pk,\n                                            self.name)\n            logger.debug('Invalidating cache for %r', cache_key)\n            cache.delete(cache_key)\n\n        return value.raw\n\n    def get_prep_value(self, value):\n        if isinstance(value, Markup):\n            return value.raw\n\n        return value\n\n    def value_to_string(self, obj):\n        value = self._get_val_from_obj(obj)\n        return self.get_prep_value(value)\n\n    def formfield(self, **kwargs):\n        defaults = {'widget': MarkupTextarea}\n        defaults.update(kwargs)\n        return super(MarkupField, self).formfield(**defaults)\n\n    def deconstruct(self):\n        name, path, args, kwargs = super(MarkupField, self).deconstruct()\n        kwargs.pop('help_text', None)\n        return name, path, args, kwargs\n", "path": "pootle/core/markup/fields.py"}]}