Answer the question
In order to leave comments, you need to log in
How to add models to the admin panel?
Hello! Added display of my model in the admin panel:
But on the edit page, a void is displayed with the inscription:
Please tell me where I could make a mistake and how to fix it.
admin.py code:
from django.contrib import admin
from shop.models import Product
admin.site.register(Product)
from django.db import models
class Product(models.Model):
visible = models.BooleanField(default=True)
sdescr = models.CharField(max_length=40)
ldescr = models.CharField(max_length=200, null=True)
cost = models.IntegerField()
class Meta:
verbose_name_plural = 'Продукты'
verbose_name = 'Продукты'
Answer the question
In order to leave comments, you need to log in
It is necessary to register the relationship of the model with the successor of ModelAdmin, and not the model.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question