[Django] #24052: Document how to use models from other apps in RunPython

7 views
Skip to first unread message

Django

unread,
Dec 26, 2014, 4:10:03 AM12/26/14
to django-...@googlegroups.com
#24052: Document how to use models from other apps in RunPython
------------------------------------------------+------------------------
Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
A common use case for RunPython (known in South as data migrations) is to
port data from one model to another. When you do this across apps, you
must add the other app to `dependencies`. Other you get a moderately
helpful:
`LookupError: No installed app with label 'people'.`

Do you think it's worth documenting?

--
Ticket URL: <https://code.djangoproject.com/ticket/24052>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 26, 2014, 6:16:25 AM12/26/14
to django-...@googlegroups.com
#24052: Document how to use models from other apps in RunPython
-------------------------------------+-------------------------------------
Reporter: aaugustin | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by aaugustin):

Here's an interesting variant of this problem.

If you attempt to use a relation that's defined in another app, the
relation doesn't exist unless you include that app in your dependencies.

--
Ticket URL: <https://code.djangoproject.com/ticket/24052#comment:1>

Django

unread,
Dec 26, 2014, 7:50:28 AM12/26/14
to django-...@googlegroups.com
#24052: Document how to use models from other apps in RunPython
--------------------------------------+------------------------------------

Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
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 timgraham):

* stage: Unreviewed => Accepted


Old description:

> A common use case for RunPython (known in South as data migrations) is to
> port data from one model to another. When you do this across apps, you
> must add the other app to `dependencies`. Other you get a moderately
> helpful:
> `LookupError: No installed app with label 'people'.`
>
> Do you think it's worth documenting?

New description:

A common use case for RunPython (known in South as data migrations) is to
port data from one model to another. When you do this across apps, you

must add the other app to `dependencies`. Otherwise you get a moderately


helpful:
`LookupError: No installed app with label 'people'.`

Do you think it's worth documenting?

--

Comment:

Definitely. I thought this came up before, but I can't find a ticket or
any docs.

--
Ticket URL: <https://code.djangoproject.com/ticket/24052#comment:2>

Django

unread,
Dec 26, 2014, 7:55:58 AM12/26/14
to django-...@googlegroups.com
#24052: Document how to use models from other apps in RunPython
--------------------------------------+------------------------------------

Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
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
--------------------------------------+------------------------------------

Comment (by MarkusH):

This should definitely be covered in the docs. I only think I can recall
to have read somewhere are the few lines I wrote down in my
[https://markusholtermann.eu/#how-do-i-add-a-data-migration Django 1.7:
Database Migrations done right] blog post.

--
Ticket URL: <https://code.djangoproject.com/ticket/24052#comment:3>

Django

unread,
Dec 27, 2014, 11:31:54 AM12/27/14
to django-...@googlegroups.com
#24052: Document how to use models from other apps in RunPython
--------------------------------------+------------------------------------

Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
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
--------------------------------------+------------------------------------

Comment (by iambibhas):

I recently faced this when migrating a model which had an FK to a custom
user model. The custom user model was added in the migration 0002 of my
accounts app. I had to manually add `0002_migration_name` to the
dependency list for the migration to work, otherwise it'd just complain
that it can't find the custom user model. The user models migration was
not added to the dependency list automatically. I'll check if I can
reproduce this. This happened during the migration that was reported in
#24037.

--
Ticket URL: <https://code.djangoproject.com/ticket/24052#comment:4>

Django

unread,
Feb 22, 2015, 9:26:21 AM2/22/15
to django-...@googlegroups.com
#24052: Document how to use models from other apps in RunPython
--------------------------------------+------------------------------------

Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24052#comment:5>

Django

unread,
Mar 12, 2015, 1:07:04 PM3/12/15
to django-...@googlegroups.com
#24052: Document how to use models from other apps in RunPython
--------------------------------------+------------------------------------

Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24052#comment:6>

Django

unread,
Mar 13, 2015, 1:24:06 PM3/13/15
to django-...@googlegroups.com
#24052: Document how to use models from other apps in RunPython
--------------------------------------+------------------------------------
Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"b089759d6025582f36fbea3c4be3855c50b82462" b089759]:
{{{
#!CommitTicketReference repository=""
revision="b089759d6025582f36fbea3c4be3855c50b82462"
Fixed #24052 -- Doc'd how to write data migrations with models in multiple
apps.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24052#comment:7>

Django

unread,
Mar 13, 2015, 1:26:06 PM3/13/15
to django-...@googlegroups.com
#24052: Document how to use models from other apps in RunPython
--------------------------------------+------------------------------------
Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: master

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"9bb451aedba9761eb78968183d21a7e27a7c7f1b" 9bb451ae]:
{{{
#!CommitTicketReference repository=""
revision="9bb451aedba9761eb78968183d21a7e27a7c7f1b"
[1.7.x] Fixed #24052 -- Doc'd how to write data migrations with models in
multiple apps.

Backport of b089759d6025582f36fbea3c4be3855c50b82462 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24052#comment:8>

Django

unread,
Mar 13, 2015, 1:26:07 PM3/13/15
to django-...@googlegroups.com
#24052: Document how to use models from other apps in RunPython
--------------------------------------+------------------------------------
Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: master

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"937c8a5a14c08aa3991a5774dae8db60b611dbac" 937c8a5a]:
{{{
#!CommitTicketReference repository=""
revision="937c8a5a14c08aa3991a5774dae8db60b611dbac"
[1.8.x] Fixed #24052 -- Doc'd how to write data migrations with models in
multiple apps.

Backport of b089759d6025582f36fbea3c4be3855c50b82462 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24052#comment:9>

Reply all
Reply to author
Forward
0 new messages