Simon,
I think we're both looking for the same feature. Here's another
example. Say I have an address model:
class Address(models.Model):
address1 = models.CharField(maxlength=100)
address2 = models.CharField(maxlength=100)
city = models.CharField(maxlength=32)
state = models.StateField()
zip = models.CharField(maxlength=11)
I want to apply it to a School and Restaurant model:
class School(models.Model):
name = models.CharField(maxlength=32)
description = models.TextField()
address = models.ForeignKey(Address,
edit_inline_here=models.STACKED)
class Restaurant(models.Model):
name = models.CharField(maxlength=32)
address = models.ForeignKey(Address,
edit_inline_here=models.STACKED)
Note that I used a fake keyword "edit_inline_here". What this would
theoretically do is, instead of putting School and Restaurant sections
in the Address admin view, the School and Restaurant's admin view
would get an Address section. Using "edit_inline", the Address admin
view would have both School and Restaurant blocks, which doesn't
really make sense.
I wouldn't mind trying to add this to the admin app myself; could
someone point me to where in the code I should start looking?
Thanks!
-berto.
On Feb 14, 2:45 am, "simonbun" <[EMAIL PROTECTED]> wrote:
> Maybe an example is in order to explain my point further:
>
> class Base:
> name
> slug
> created_at
> created_by
> ...
> content_type = models.ForeignKey(ContentType)
> object_id = models.PositiveIntegerField()
> content_object = models.GenericForeignKey()
>
> class Product:
> base = models.ForeignKey(Base, edit_inline=models.STACKED)
> price
> weight
> ...
>
> Now if I were to create a new Product object in the admin, I would get
> all the fields of the Base class and the additional fields from the
> Product class. When saving a product a Base object and a Product
> object get created and linked to each other.
>
> Granted, this is a very simple implementation of model inheritance and
> wouldn't be a good performer seeing as no joins can be made. I still
> think this would make a great addition to the admin contrib and would
> be useful to a lot of us out there.
>
> Comments / Advice / +1 / -1 / ... would be appreciated
>
> Regards,
> Simon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---