I get <class 'locations.models.Location'> has no ForeignKey to <class
'theater.models.Theater'> each time I try to edit Theater model. I saw
multi-table-inheritance[1] approach but interesting in this one w/o
inheritance. Could you bring an idea how to get Theater's form with
Location model within it?

Code looks like below:

class Location(models.Model):
    latitude = models.FloatField()
    longitude = models.FloatField()

class Theater(models.Model):
    location = models.OneToOneField(Location, related_name="theater")

class LocationInline(admin.StackedInline):
    model = Location
    can_delete = False

class TheaterAdmin(admin.ModelAdmin):
    inlines = [ LocationInline, ]

Thank you!

[1] 
https://docs.djangoproject.com/en/dev/topics/db/models/#multi-table-inheritance

-- 
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