#25765: makemigrations and app_label are incompatible
--------------------------------------+------------------------------------
     Reporter:  ograycode             |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Documentation         |                  Version:  1.8
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by knbk):

 * needs_better_patch:   => 0
 * component:  Uncategorized => Documentation
 * needs_tests:   => 0
 * needs_docs:   => 0
 * type:  Uncategorized => Cleanup/optimization
 * stage:  Unreviewed => Accepted


Comment:

 The behaviour is correct. By changing the `app_label`, you are effectively
 moving the model to a different app without changing the file location. If
 the new app label is the label of a valid Django app, you will be able to
 create migrations for that model using the explicitly defined `app_label`.

 Django currently does not support moving a model from one application to
 another. That's why it sees the model as a new model when you remove the
 explicit app label, and sees it as a deleted model when you change the app
 label again. The new app label you define is not recognized as a valid
 app, so it is treated as an unmigrated app (or the model might be ignored
 by `manage.py migrate` - something to figure out as well).

 We can expand the description of
 [https://docs.djangoproject.com/en/1.8/ref/models/options/#app-label
 Meta.app_label] and link to
 
[https://docs.djangoproject.com/en/1.8/ref/applications/#django.apps.AppConfig.label
 AppConfig.label] to clarify that changing the `app_label` also changes the
 app in which the model lives according to Django. The django-admin page
 has a [https://docs.djangoproject.com/en/1.8/ref/django-admin/#app-names
 short section] about the "app name" used by various commands. I suggest we
 change the terminology to app label to clarify its meaning and be
 consistent with the rest of the documentation. This section could also be
 a bit more elaborate.

--
Ticket URL: <https://code.djangoproject.com/ticket/25765#comment:1>
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/067.b2ae0c1539f5f1d6bdd9425b7ca31dd7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to