Changes between Initial Version and Version 1 of Ticket #7586


Ignore:
Timestamp:
07/01/2008 08:33:25 PM (7 years ago)
Author:
mtredinnick
Comment:

(Fixed description formatting somewhat)

Can you please confirm that you have the Meta.app_label attribute set on both these models? And that they are set to different things? If you have models inside subdirectories, app_label must be set, otherwise Django cannot work out the app_name correctly. It sounds like the only reasons that models from both applications are being pulled back is because Django thinks their app names are sub (when they should be app1 and app2).

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7586

    • Property Patch needs improvement unset
    • Property Needs tests unset
    • Property Needs documentation unset
  • Ticket #7586 – Description

    initial v1  
    11if i have 2 applications - app1, app2 , both with a sub-module sub:
     2{{{
    23app1/sub/models.py
    34app2/sub/models.py
     5}}}
    46
    57then only models from one of the apps will get a row in the django_contenttypes table.
    68
    7 This is because, when processing app2 - in update_contenttypes (contenttypes/manangement.py) first gets all current contenttypes for app1 (\
    8 because the query ContentType.objects.filter(app_label=app.__name__.split('.')[-2]) returns all the rows for app1 and app2)
    9 and then after inserting all the objects for app2 (which are not present there) - it deletes all the previous objects inserted for app1 because it thinks they're 'stale' (they weren't part of get_models(app2))
     9This is because, when processing app2 - in update_contenttypes (`contenttypes/manangement.py`) first gets all current contenttypes for app1 (because the query `ContentType.objects.filter(app_label=app.__name__.split('.')[-2])` returns all the rows for app1 and app2)
     10and then after inserting all the objects for app2 (which are not present there) - it deletes all the previous objects inserted for app1 because it thinks they're 'stale' (they weren't part of `get_models(app2)`)
Back to Top