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
4 answers

how to add a datetimefield to admin changelist's search_fields

In a model's changelist page on admin, I added a DateTimeField "birth" to search_fields. class DataLog(models.Model): id = models.AutoField(primary_key=True, verbose_name="idd") birth = models.DateTimeField(auto_now_add=True,…
fanlix
  • 1,248
  • 1
  • 13
  • 22
4
votes
6 answers

Django Admin: two ListFilter Spanning multi-valued relationships

I have a Blog model and an Entry model, following the example in django's documentation. Entry has a ForeignKey to Blog: one Blog has several Entries. I have two FieldListFilters for Blog: one for "Entry title", one for "Entry published year". If in…
guettli
  • 25,042
  • 81
  • 346
  • 663
4
votes
2 answers

Django admin - delete_selected problem

In admin.py file i paste: admin.site.disable_action('delete_selected') And get an error: KeyError at / 'delete_selected' Django Version: 1.3 Exception Type: KeyError Exception Value: 'delete_selected' Exception Location: …
robos85
  • 2,484
  • 5
  • 32
  • 36
4
votes
1 answer

How to properly add a custom field as a callable to Django admin change form?

I'm trying to add a custom field (pretty_user) to a model's admin page that displays the user info in a nice way. I'm adding the model as a callable directly in the ModelAdmin class. This works beautifully in the list_display view but it totally…
everspader
  • 1,272
  • 14
  • 44
4
votes
1 answer

Filtering django admin inline - limit the choices list

Given my inline admin: class TestInlineAdmin(admin.TabularInline): model = Test.questions.through extra = 0 and then class QuestionAdmin(admin.ModelAdmin): inlines = [TestInlineAdmin, ] Test model has question field which is…
4
votes
1 answer

Get Django Custom user model listed under admin app `Authentication and Authorization`

Note my question is similar to this one, however that answer recommend not calling the customised user model User, whereas the official docs and this issue do. I created a custom User model in an app called plug: plug/models.py: from django.db…
run_the_race
  • 1,344
  • 2
  • 36
  • 62
4
votes
4 answers

disable dark mode in django admin

The Problem I installed Django after couple of months. Current version is 3.2.4. Earlier Django-admin was just light-mode. Current Django-admin switches automatically to dark or light according to system theme. Well, I do not want this behaviour. I…
ajinzrathod
  • 925
  • 10
  • 28
4
votes
2 answers

Dynamic Form fields in `__init__` in Django admin

I want to be able to add fields to django admin form at runtime. My model and form: #admin.py class SitesForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(SitesForm, self).__init__(*args, **kwargs) …
Vadym
  • 1,444
  • 21
  • 37
4
votes
1 answer

Django admin action-select checkbox removal?

Pretty simple question. I have removed the top select-box, for choosing an action to perform on the selected models. However, the leftmost checkbox does not disappear, even though I have no action toolbar neither in top or in bottom. This is very…
Hoof
  • 1,738
  • 2
  • 17
  • 39
4
votes
2 answers

Django Administration: Delete record from custom user model

I have created a custom user model (users_user) which works for registering new users (creating new custom user records) and logging in. But if I go to the Admin page, and try to delete a user record from there, it seems to be trying to delete…
Tom
  • 364
  • 2
  • 19
4
votes
4 answers

Django admin view uploaded photo

I have implemented photo upload in Django but I have a problem to view it Django admin. models.py class WorkPlacePhoto(models.Model): file = models.FileField(storage=FileSystemStorage(location=settings.MEDIA_ROOT), upload_to='uploads') Photos…
brsbilgic
  • 11,613
  • 16
  • 64
  • 94
4
votes
2 answers

How to restrict non staff users from accessing django-admin

My django-admin page is located at http://127.0.0.1:8000/admin/ Suppose there are 3 users in my website. Superuser Staff End user If anyone of these three users tries to access this link http://127.0.0.1:8000/admin/, 1st and 2nd can access…
ajinzrathod
  • 925
  • 10
  • 28
4
votes
0 answers

Edit ManyToMany Inline fields with self relationship in Django Admin change form

How can I get a model's fields to be editable in the Inline in a ManyToMany relationship when the relationship is with itself? class MyModel(models.Model): children = models.ManyToManyField( 'self', related_name='parents', …
everspader
  • 1,272
  • 14
  • 44
4
votes
1 answer

How To Move "Add Another" Link Button Inline To The Top Django Admin

I am working on a Django project and I would want to move the 'Add Another' link to the top of the inlines. The long list of inline records make it hard to add another field, that's why I want to move the bottom to the top.
4
votes
2 answers

How can I have Django user registration single step (instead of two step)process with email compulsory?

I want Django to send an email to user email-address with Login details once admin adds a new user to admin site.So I tried using Django signals for that but just becoz django user registration is a two step process signals get notified in first…
Anshul
  • 7,914
  • 12
  • 42
  • 65