Hi All,
Just a quick query to see if anyone has any ideas on this one.
I have a model in my application that inherits from the django User
model. In the admin site, without any extra configuration (just using
ModelAdmin), I get a standard edit form with the custom model's fields
as well as the django User fields.
The problem that I have is that a "change password" link is generated
(which is desirable), but the url is not routed properly - resulting
in an error. The url looks like "/CustomModel/id/password". Digging
around in /contrib/auth/admin.py (working off of memory :P) it looks
like UserAdmin does some voodu magic to hijack the request and execute
some "view logic" in the case of a url that looks like a password
change request.
It looks something like this (psuedocode):
// inside of __call__ method
if url is a password url:
return result of change password method call on UserAdmin
object
else
delegate to base class
I can get the change password form to work by simply using the
UserAdmin class, but it explicitly defined the fieldsets (which of
course don't include my custom fields). As a side note, might it be
possible to define the fieldsets in __init__? I was under the
impression that the fieldsets are metadata for the class not the
instance. Even if this is the case I believe I would still have to
duplicate the User model fieldsets.
Multiple inheritance doesn't seem to work (not surprisingly), and I
wouldn't be thrilled about that approach anyway.
So, my "solution" was to duplicate this logic in my admin class, and
it works just fine now. Anyone have any better ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---