Changes between Version 1 and Version 2 of Ticket #16368, comment 16


Ignore:
Timestamp:
Nov 24, 2013, 3:37:18 PM (11 years ago)
Author:
Ramiro Morales

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16368, comment 16

    v1 v2  
    11Some findings and notes:
    22
    3 Bisection betwen 1.2 and 1.3 (the two releases the OP reports things changed from working to not working e.g. the custom Sites model gets replaced by the `contrib.sites` app one even when that app isn't listed in INSTALLED_APPS) shows the changeset where that change in behavior appeared is r14769.
     3Bisection betwen 1.2 and 1.3 (the two releases the OP reports things changed from working to not working e.g. the custom Sites model gets replaced by the `contrib.sites` app one even when that app isn't listed in INSTALLED_APPS) shows the commit where that change in behavior appeared is r14769.
    44
    5 (Conditions are: Using the simple `foobar` project attached to this ticket and adding `django.contrib.contenttypes import generic` to its `sites/models.py`)
     5(Conditions are: Using the simple `foobar` project attached to this ticket and adding `django.contrib.contenttypes import generic` to its `sites/models.py` file).
    66
    77I don't think the changes from that commit in particular are wrong regarding this issue. Looking at the traceback in comment:12 IMHO what's the culprit of this unexpected behavior is the fact that `django.contrib.contenttypes.generic` contains both the definitions of the model-related generic stuff (!GenericForeignKey, etc.) AND the admin app-related specialized inlines (!GenericInlineModelAdmin, !GenericStackedInline, !GenericTabularInline.)
    88
    9 So, for example, if you import `django.contrib.contenttypes.generic` from your `models.py` because you need !GenericForeignKey then the Generic*Inline* sutff imports `django.contrib.admin` and it in its own turn imports `contrib.sites` causing the observed failure. Again, the Sites framework isn't listed in INSTALLED_APPS and what is worse: The admin app isn't either (!).
     9So, for example, if you import `django.contrib.contenttypes.generic` from your `models.py` because you need !GenericForeignKey then the Generic*Inline* stuff imports `django.contrib.admin` and it in its own turn imports `django.contrib.sites` causing the observed failure. Again, the Sites framework isn't listed in `INSTALLED_APPS` and what is worse: The admin app isn't either (!).
    1010
    1111Maybe it's time we move !GenericInlineModelAdmin, !GenericStackedInline, !GenericTabularInline from `django.contrib.contenttypes.generic` to, say, `django.contrib.contenttypes.generic_admin`? (of course this would need a deprecation process)
Back to Top