Sunday, December 13, 2009

Re: Can't delete a User from within admin

On Sun, Dec 13, 2009 at 1:46 PM, Hanne Moa <hanne.moa@gmail.com> wrote:
> When I try to delete a user from within the admin I get:
>
> TypeError at /admin/auth/user/
>
> super(type, obj): obj must be an instance or subtype of type
>
> It's triggered by:
>
> File "/home/django-sites/CALS/cals/models.py" in get_query_set
>  99.         return super(DescriptionManager,
> self).get_query_set().filter(current=True)
>
> This manager sits on a model that has a foreign key to User.
>
> class DescriptionManager(models.Manager):
>
>    def get_query_set(self):
>        return super(DescriptionManager,
> self).get_query_set().filter(current=True)
>
> class Description(Freetext):
>    # Freetext has abstract=True
>    ..
>    objects = DescriptionManager()
>    ..
>
> The manager's self is at that moment a
> django.db.models.fields.related.RelatedManager.
>
> I can delete the User from within the shell just fine with
> user_instance.delete()

I'd suggest to read the Django documentation about managers,
in particular the sections about default managers, and how they
(are not) used by the admin application.

HTH

--
Ramiro Morales | http://rmorales.net

--

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate