How to show related objects in Django/Admin?

前端 未结 3 1365
野的像风
野的像风 2021-02-07 02:19

I have 2 models:

from django.db import models

class Category(models.Model):
    icon = models.ImageField(upload_to = \'thing/icon/\')
    image = models.ImageFi         


        
3条回答
  •  暖寄归人
    2021-02-07 02:47

    Few minutes ago, searching how to solve a similar problem, I finally found a solution.

    You actually have to follow @Matteo Scotuzzi answer as well, then

    Inside admin.py located in the app your created those models, you have to declare as follows right bellow @Matteo snippet:

    admin.site.register(Category, CategoryAdmin)
    

    and that would be enough to make all "Things" appear in "Category" inside your Django Administration respective page which is "Category".

提交回复
热议问题