Skip to content Skip to sidebar Skip to footer

Displaying Table Using Models In Django Admin

I am trying to create a project management kind of app. Now I have the project model like in this image When i save it, i can able to get username and time. Now. In the same page

Solution 1:

You may want either AdminInline or list_editable Django features:

  1. If you have linked models, say a Project and a Product, which is linked to Project, you can make your product editable as inlines:

    classProductInline(admin.TabularInline):
        model =Product
    
    classProject(admin.ModelAdmin):
        model = Project
        inlines = [ProductInline, ]
    
  2. If you have a standalone table, say, Product, you can make its list to be editable:

    classProductAdmin(admin.ModelAdmin):
        model = Productlist_display= ['quantity', 'description', 'tax_rate', ] 
        list_editable = ['quantity', 'description', 'tax_rate', ] 
    

Post a Comment for "Displaying Table Using Models In Django Admin"