Questions tagged [django-admin]

Django's built-in, automatic admin interface (django.contrib.admin) which is part of the Django Web framework for the Python programming language.

One of the most powerful parts of Django is the automatic admin interface. It reads metadata from your models to provide a quick, model-centric interface where trusted users can manage content on your site. The admin’s recommended use is limited to an organization’s internal management tool. It’s not intended for building your entire front end around.

-- Django Admin Documentation

Resources:

10185 questions
4
votes
2 answers

Django Admin exclude model from index and app page

I want to hide some models from admin index page and app page. For example, these that I have visible in inlines as related objects. One more point, I want to keep the ability to work with change_view and add_view, but not list_view of that…
wowkin2
  • 5,895
  • 5
  • 23
  • 66
4
votes
1 answer

In Django Admin, can you limit the filter options, based on the search results?

I have a Django application that has the following example models: class Artist(models.Model): name = models.CharField(max_length=200) class Album(models.Model): name = models.CharField(max_length=200) ... num_stars =…
SWater
  • 384
  • 1
  • 13
4
votes
2 answers

Django admin - prevent objects being saved, and don't show the user confirmation message

I want to prevent admins modifying certain data in django. I've done this, but when the user hits 'save', the data is correctly not saved, but the 'success' message is displayed at the top telling the user the data was updated. How can I replace…
Brad
  • 43
  • 3
4
votes
2 answers

CSS missing from django admin pages on development server after execution of drop database

I have been messing around with a simple django 1.3 toy project using MySQL, and decided to change a lot of my models around. After doing so, I needed to clear the database and "start afresh" so I used "drop database db" in the mysql prompt.…
Boris Burkov
  • 41
  • 1
  • 4
4
votes
3 answers

Django admin media not loading

I'm trying to deploy this application with nginx/gunicorn but I don't know why the admin media files are missing. settings.py: ADMIN_MEDIA_PREFIX = '/srv/www/antingprojects.com.ar/gobras/static/admin/' I also tried: ADMIN_MEDIA_PREFIX =…
mfalcon
  • 880
  • 1
  • 11
  • 25
4
votes
2 answers

Link To Foreignkey in Admin Causes AttributeError When Debug Is False

I have used the following code in my models.py file: Create hyperlink to foreignkey class ModelAdminWithForeignKeyLinksMetaclass(MediaDefiningClass): def __getattr__(cls, name): def foreign_key_link(instance, field): …
Crazyconoli
  • 641
  • 1
  • 6
  • 18
4
votes
1 answer

django filter multi select list in admin

I have a django model with a self referencing many to many field as below. class Product(ModelBase): name = models.CharField(max_length=1000) category = models.ForeignKey(Category, on_delete=models.DO_NOTHING) company =…
Chirdeep Tomar
  • 4,281
  • 8
  • 37
  • 66
4
votes
1 answer

Sphinx search in django admin

Trying to use sphinx search in django admin. Installed django-sphinx. Did as Docs tell: from djangosphinx.admin import SphinxModelAdmin class MyAdmin(SphinxModelAdmin): index = 'my_index_name' # defaults to Model._meta.db_table …
San4ez
  • 8,091
  • 4
  • 41
  • 62
4
votes
0 answers

How to remove default delete confirmation message from django admin on overriding delete queryset method?

I want to override the default delete_queryset method in admin to prevent deleting last object. def delete_queryset(self, request, queryset): warehouses = self.model.objects.all() if warehouses.count() == 1: …
Aarti Joshi
  • 325
  • 1
  • 8
  • 17
4
votes
1 answer

Difference between Wagtail admin Site and Django admin Site?

This may be a basic question, but it puzzles me and I couldn't find an answer on the web. In my Wagtail admin I see a menu entry 'Sites' with (in my case) one item, in which I can configure a host name, a port, a site name, a Wagtail root page and a…
Paul Rene
  • 680
  • 4
  • 14
4
votes
1 answer

How can I show auto_now_add field in Django admin?

I have a model (as below) and in that, I've set auto_now_add=True for the DateTimeField class Foo(models.Model): timestamp = models.DateTimeField(auto_now_add=True) From the doc, As currently implemented, setting auto_now or auto_now_add to…
JPG
  • 82,442
  • 19
  • 127
  • 206
4
votes
1 answer

Setting verbose name of function field in Django

I have a simple Model like this: class Artist(models.Model): class Meta: verbose_name = "Artist" verbose_name_plural = "Artists" name = models.CharField(max_length=128, unique=True, blank=False) def…
Daniel W.
  • 31,164
  • 13
  • 93
  • 151
4
votes
0 answers

how to add to django admin list_editable a reverse relation Field

These are my simple models. class Customer(models.Model): name = models.CharField(max_length=50) email = models.EmailField(null=True, blank=True, unique=True) phone = models.CharField(max_length=30, null=True, blank=True) def…
4
votes
3 answers

django table has no column named Exception

Git Repository Request to guide me on what to do. I work on an e-commerce website with the help of Django. and I'm a beginner in Django The following image provides a table of my database. It helps to add a product Shows me an error in the browser.…
Brijesh Kalkani
  • 789
  • 10
  • 27
4
votes
2 answers

How to override queryset used by Django admin/form for a Foreign Key

I've tried everything I can find on the internet here, and nothing seems to work, so wondering if lots of the previous answers are for old versions. I'm on Django 2.2.9. #models.py class ParentModel(models.Model): title =…
MDalt
  • 1,681
  • 2
  • 24
  • 46