If you're not doing anything fancy with AdminSite objects (ie, you're
only using the default admin site), then do this:

# assuming you've already done: from django.contrib import admin
admin.site.unregister(MyModel)

Note that it's exactly the opposite of the normal "admin.site.register
()" method, except that it only ever takes the one argument, not two.

I do this for changing the default User model admin. I unregister it,
alter the UserAdmin provided in Django, and then re-register it with
my own.

Tim

On Nov 24, 1:54 pm, Tomasz Zieliński
<[email protected]> wrote:
> Is there a way to unregister model from being seen by Django model
> manager?
> I have some unmanaged models that are wrappers around read-only
> database views
> and also have foreign keys to 'real' models.
>
> Now, when I'm trying to delete instance of 'real' model that is
> referenced by unmanaged model,
> I'm getting OperationalErrors as Django tries to perform cascade
> delete.
>
> As a solution, I'd like to unregister my unmanaged models
> before .delete(),
> and re-registering them after, but I don't know how to do it.
>
> --
> Tomasz Zielinskihttp://pyconsultant.eu

--

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.


Reply via email to