When I add an app with the name
advertisements (add models, admin + register in
INSTALLED_APPS) it is not listed in the admin interface (it is very hard to see but it disappears after microseconds).
from django.db import models # Create your models here. class Advertisement(models.Model): pass
from django.contrib import admin from .models import Advertisement # Register your models here. @admin.register(Advertisement) class AdvertisementAdmin(admin.ModelAdmin): pass
from django.apps import AppConfig class AdvertisementsConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'advertisements'
INSTALLED_APPS = [ # ... "advertisements", ]
Changing an app directory to something like
advertisements2, app name (in
advertisements2 solves the problem.
Why the app with the name ‘advertisements’ is not listed in the admin interface?" What is the issue with the name "advertisements"?
I tested in many times in completely blank project.
The question seemd to be a bit strange for me at the beginning and I was feeling super curious about what is going on. I recreated your code perfectly and I was getting the same result as you. No
advertisemets app in admin panel. I started a debugger and tracked execution line by line, and everything seemd to be in order. But after some time it occured to me, that it could not be actually django’s fault. And it is not! Beware the most intriguing solution to your problem:
Just disable your adblocker and refresh the site!
What is most problably the problem (and what was the problem on my site) is that my adblocker blocked the word
advertisement and all the styles that came with it. So with your adblocker turned on, if you were to inspect a site you would see your
advertisements app sitting comfortably in your html code:
<div class="app-advertisements module"> <table> <caption> <a href="/admin/advertisements/" class="section" title="Models in the Advertisements application">Advertisements</a> </caption> <tbody><tr class="model-advertisement"> <th scope="row"><a href="/admin/advertisements/advertisement/">Advertisements</a></th>
If you were to remove
app-advertisements class from
<div class="app-advertisements module"> (again, with the adblocker still turned on) the Advertisement should magically apear in admin panel.
Answered By – Mateusz Anikiej