I have a model (Booking) with a OneToOneField (Thread) that subsequently has a ForeignKey relationship (Message). I would like to show a list of messages on the Booking admin, but with the Thread model in between it appears that this is hard/not possible?
Class Booking(Model):
...
thread = models.OneToOneField('user_messages.Thread', verbose_name='thread')
class Thread(Model):
...
class Message(Model):
thread = models.ForeignKey(Thread, related_name="messages")
Is there a way I can set up my BookingAdmin with an inline that can display messages (spanning across the thread relationship)? Something like:
class MessageInline(TabularInline):
model = Message
fk_name = '???'
class BookingAdmin(ModelAdmin):
inlines = [MessageInline, ]
I'm happy to override the way the Inlines work if that's the best way, but I'm not sure where to tackle that. It looks like overriding *get_formset* might do the trick?