Presently, there's not a way without altering models to be able to have 
inline models if dependencies are declared on the "owning" class. Allow me 
to explain with code:

class Person(models.Model):

    address = models.OneToOneField("Address")

class Monument(models.Model): 
    address = models.OneToOneField("Address")

class Sighting(models.Model):
    address = models.OneToOneField("Address")

class Address(models.Model):
    name = models.CharField(...)
    street_address = models.CharField(...)


The goal with this code is that a `Person` owns an `Address` like a 
`Monument` owns an `Address` like a `Sighting` owns an `Address`. There's 
really no reason for an `Address` to know of itself what it is owned by, it 
could be owned by multiple different objects. The lookup needs to happen 
from the owner.

When attempting to make inlines for these types of relations, an error is 
thrown:

class AddressInline(admin.TabularInline):
    model = Address
    fields = ('street_address',)

class SightingAdmin(admin.ModelAdmin):
    inlines = (AddressInline,)


 Here's the error which is thrown by a *similar* real example: 
http://pastebin.com/rQreWCwY

<http://i.imgur.com/a0iEt.png>

IMHO, inlines should work regardless of which side the relationship is 
declared on. Can I submit this for a feature request? 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/WOdxe54kb1kJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to