Answer the question
In order to leave comments, you need to log in
How to display the ForeignKey fields of the second level model in the Django admin?
How to make image field output in one line before TwoInline fields?
models.py
class One(models.Model):
image = models.ImageField()
class Two(models.Model):
one = models.ForeignKey(One,on_delete=models.CASCADE)
three = models.ForeignKey(Three,on_delete=models.CASCADE)
class Three(models.Model):
pass
class TwoInline(admin.TabularInline):
model = Two
@admin.register(Three)
class ThreeAdmin(admin.ModelAdmin):
inlines = [TwoInline]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question