contrib.contenttypes.generic importing from contrib.admin causing trouble

2012-11-05 Thread Jens Ådne Rydland
Not really sure what to use as subject here, or whether this qualifies
to be called a bug, but I don't think it belongs on django-users due to
being an issue in Django itself so I figured I'd ask here before opening
a ticket.

So, we have a project that doesn't use contrib.auth, and it doesn't use
contrib.admin, it does, however, use contrib.contenttypes.generic. And
c.c.generic imports InlineModelAdmin and flatten_fieldsets from
contrib.admin.options, which does some more imports which down the line
causes various models to be imported from contrib.auth.models, and this
in turn causes the auth models to be registered in AppCache, and thus to
be found by db.models.Options' get_all_related_objects() which is used
by db.models.deletion.Collector.collect().

This hasn't caused us any trouble so far, but now that we needed to
delete some stale ContentTypes we suddenly got weird crashes related to
contrib.auth tables not existing when delete() tried to find foreign
keys pointing to ContentType. 

I've tested moving the admin related bits from contenttypes/generic.py
to contenttypes/admin.py, which seems to have fixed our immediate
problem, but haven't really tested if it breaks anything else. And I
guess this could be considered a too obscure corner case to care about,
but would appreciate some feedback anyway. 


-- 
Jens Ådne Rydland

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Calling update() on EmptyQuerySet updates all rows in database

2009-11-03 Thread Jens Ådne Rydland

Came across an issue with EmptyQuerySet today, it seems it does not
behave correctly with regard to update(). (or that the documentation is
lacking, I suspect it's the former)

Assuming I have a model Foo of which I have say 42 stored instances in
the database, each with a CharacterField "bar".

If I do Foo.objects.none().count() I get the expected result 0.
However, Foo.objects.none().update(bar='baz') returns 42, and all 42
rows in the database have been updated.

This seems to be caused by EmptyQuerySet not overriding update(),
shouldn't this just return 0?

-- 
best regards, Jens Ådne Rydland

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---