#16368: Custom sites model overridden by contrib.sites.model.Site
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  briehan.lombaard@…                 |         Status:  reopened
                   Type:  Bug        |      Component:  contrib.sites
              Milestone:             |       Severity:  Normal
                Version:  SVN        |       Keywords:
             Resolution:             |      Has patch:  0
           Triage Stage:  Accepted   |    Needs tests:  0
    Needs documentation:  0          |  Easy pickings:  0
Patch needs improvement:  0          |
                  UI/UX:  0          |
-------------------------------------+-------------------------------------

Comment (by ramiro):

 Some findings and notes:

 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.

 (Conditions are: Using the simple `foobar` project attached to this ticket
 and adding `django.contrib.contenttypes import generic` to its
 `sites/models.py`)

 I 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.)

 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 worth: The
 admin app isn't either (!).

 Maybe 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 path)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16368#comment:16>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to