Answer the question
In order to leave comments, you need to log in
Why doesn't the django admin site add an entry section for the model?
The section for Advertisement does not appear on the site, although everything seems to be entered correctly.
There is a model file: model.py
from django.db import models
class Advertisement(models.Model):
title = models.CharField(max_length=1000)
description = models.CharField(max_length=1000, default='', verbose_name='Описание')
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
price = models.FloatField(verbose_name='Цена', default=0)
views_count = models.IntegerField(verbose_name='Количество просмотров', default=0)
status = models.ForeignKey('AdvertisementStatus', default=None, null=True, on_delete=models.CASCADE,
related_name='advertisements', verbose_name='Статус')
def __str__(self):
return self.title
class Meta:
db_table = 'advertisements'
ordering = ['title']
class AdvertisementStatus(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
from django.contrib import admin
from .models import *
@admin.register(Advertisement)
class AdvertisementAdmin(admin.ModelAdmin):
pass
Answer the question
In order to leave comments, you need to log in
Is the application with this model definitely included in INSTALLED_APPS in the settings?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question