Почему не добавляются модели в админку? Миграции сделал, сижу с суперсюзера, приложение зарегистрировано в INSTALLED_APPS, проект запускаю на локалке.
Код:
models.py
from django.db import models
# Create your models here.
class Advertisements(models.Model):
title = models.CharField(max_length=200, verbose_name='Заголовок')
text = models.TextField(max_length=1000, verbose_name='Текст')
date = models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')
status = models.ForeignKey('AdvertisementsStatus', default=None, null=True, on_delete=models.CASCADE,
related_name='status')
publisher = models.ForeignKey('AdvertisementsInfo', default=None, null=True, on_delete=models.CASCADE,
related_name='publisher')
heading = models.ForeignKey('AdvertisementHeading', default=None, null=True, on_delete=models.CASCADE,
related_name='heading')
def get_absolute_url(self):
return '/advertisement/{}'.format(self.id)
class Meta:
db_table = 'AdvertisementsTable'
class AdvertisementsStatus(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class Meta:
db_table = 'AdvertisementStatusTable'
class AdvertisementsInfo(models.Model):
user_name = models.CharField(max_length=100, verbose_name='Имя пользователя')
phone_number = models.CharField(max_length=100, verbose_name='Телефон пользователя')
class Meta:
db_table = 'AdvertisementsInfoTable'
class AdvertisementHeading(models.Model):
name = models.CharField(max_length=100, verbose_name='Рубрика')
def __str__(self):
return self.name
class Meta:
db_table = 'AdvertisementsHeadingTable'
class AdvComments(models.Model):
advertisement = models.ForeignKey('Advertisements', default=None, null=True, on_delete=models.CASCADE,
related_name='comments')
user_name = models.CharField(max_length=20, verbose_name='Имя пользователя')
created = models.DateTimeField(auto_now_add=True)
updated = models.DateField(auto_now=True)
body = models.TextField("Комментарий")
class Meta:
db_table = 'AdvComments'
admin.py
from django.contrib import admin
from advertisements.models import Advertisements, AdvertisementHeading, AdvertisementsStatus, AdvertisementsInfo, AdvComments
# Register your models here.
admin.site.register(AdvComments)
admin.site.register(AdvertisementsStatus)
admin.site.register(AdvertisementsInfo)
admin.site.register(Advertisements)
admin.site.register(AdvertisementHeading)