On Dec 21, 10:02 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:

> On Sun, 2008-12-21 at 18:50 -0800, George Sakkis wrote:
> > Hi all,
>
> > I have a situation which I think would best be modeled as (single)
> > inheritance, involving product reviews for various kinds of products.
> > Naturally, there are some fields which are common to all reviews
> > (overall rating, user, review date) and some which are specific to the
> > type of product. Given such an appropriate model set, I'd like to use
> > the admin interface to, say, edit the reviews of a user "inline",
> > where for each review the appropriate form would be rendered (i.e.
> > including all the fields related to each given product). Is this
> > possible, and if not, is there a workaround ?
>
> My inner philosopher is protesting that if there is a workaround, that
> would make it possible to do something, right? So if it's not possible,
> there's no workaround, pretty much by definition. :-)

Well a more precise wording would be "is there a straightforward,
'correct', solution, or if not, at least an ugly kludge that at least
works ?" :-)

> Anyway, there are two answers to your question: (1) yes, it Just Works,
> and (2) What happened when you tried it? It's not really that hard to
> test this out.
>
> Create a simple model inheritance situation with Parent and Child,
> inheriting from Parent. Give the Child and admin entry and go and add a
> new child. You'll see all the Parent fields right there on the page. It
> works transparently.

Unfortunately it doesn't work for what I tried. What I am trying to do
is have the Child classes as InlineModelAdmin in some other class that
references them. Here's a sample:

# ======= models.py ===================
class Review(models.Model):
    # general fields
    class Meta:
        abstract = True

class BookReview(Review):
    # book-specific review fields

class MoviewReview(Review):
    # movie-specific review fields

# ======= admin.py ===================

class ReviewInline(admin.StackedInline):
    model = models.Review
    extra = 0

class UserReviewAdmin(admin.ModelAdmin):
    inlines = [ReviewInline]
    # more stuff

admin.site.register(models.User, UserReviewAdmin)


This dies with "type object 'Review' has no attribute
'_default_manager'", apparently because Review is not a table-backed
model. What should I be doing differently ?

George
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to