#24648: Runtime attributes on fields may confuse migrations
-------------------------------+--------------------
Reporter: Xof | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
If a model has an attribute whose value changes from development to
deployment due to a runtime dependency, this can cause migrations to think
the code has changed. (Whether it has or not is a philosophical question,
I suppose, but it's not a different set of text.)
Example:
In settings.py:
{{{
UPLOAD_ROOT = os.path.normpath(os.path.join(PROJECT_DIR, '..', '..',
'uploads'))
UPLOAD_URL = '/content/'
}}}
In the model:
{{{
upload_storage = FileSystemStorage(location=UPLOAD_ROOT,
base_url=UPLOAD_URL)
...
class Thingie(models.Model):
image = models.ImageField(upload_to='/%Y/%m/%d',
storage=upload_storage, null=True, default=None)
}}}
The migrations will consider Thingie to have changed from dev to
deployment based on the change of 'upload_storage'.
--
Ticket URL: <https://code.djangoproject.com/ticket/24648>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/046.149818df61176f7e2b91f94a7c536bf9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.