Sorry for double-post.

Additionally, you might experiment with the Meta class attribute,
"abstract = True" on your wrapper models.  It makes Django ignore the
model when it does database table creation.  That way, your wrapper
acts more like a true Python inheritance object, where you simply get
the benefits of inherited methods and fields, without the wrapper
creating its own lonely table without any data.

Not sure if it fits your situation, but it's good to know about.  It
seems like you're having to worry a bit too much about the extra
models.  There are all kinds of uses once you figure out how to use
it.

Here's the docs on it:

http://docs.djangoproject.com/en/dev/topics/db/models/#id6

On Nov 24, 2:15 pm, Tim Valenta <[email protected]> wrote:
> 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