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
77
votes
7 answers

one-to-many inline select with django admin

I have a standard many-to-one relationship set up. There are a bunch of fields, but for our purposes here, the relevant model is: class Class(models.Model): name = models.CharField(max_length=128) class Student(models.Model): class =…
MrGlass
  • 9,094
  • 17
  • 64
  • 89
77
votes
5 answers

Django Admin: Using a custom widget for only one model field

I have a DateTimeField field in my model. I wanted to display it as a checkbox widget in the Django admin site. To do this, I created a custom form widget. However, I do not know how to use my custom widget for only this one field. The Django…
Belmin Fernandez
  • 8,307
  • 9
  • 51
  • 75
77
votes
8 answers

Not able to create super user with Django manage.py

Trying to create a super user for my database: manage.py createsuperuser Getting a sad recursive message: Superuser creation skipped due to not running in a TTY. You can run manage.py createsuperuser in your project to create one…
gerosalesc
  • 2,983
  • 3
  • 27
  • 46
75
votes
1 answer

Overriding the save method in Django ModelForm

I'm having trouble overriding a ModelForm save method. This is the error I'm receiving: Exception Type: TypeError Exception Value: save() got an unexpected keyword argument 'commit' My intentions are to have a form submit many values for 3…
Josh Smeaton
  • 47,939
  • 24
  • 129
  • 164
74
votes
8 answers

Custom Filter in Django Admin on Django 1.3 or below

How can I add a custom filter to django admin (the filters that appear on the right side of a model dashboard)? I know its easy to include a filter based on a field of that model, but what about a "calculated" field like this: class…
sghael
  • 1,277
  • 1
  • 15
  • 18
74
votes
4 answers

What's the difference between staff, admin, superuser in django?

Django has superuser, staff, admin… superuser and staff are in django.contib.auth.models.UserManager. Then there is the createsuperuser command of django-admin. Well, there are admin apps… What's the difference?
eugene
  • 39,839
  • 68
  • 255
  • 489
73
votes
10 answers

Django: TemplateSyntaxError: Could not parse the remainder

I am getting this issue when I type localhost:8000/admin/. `TemplateSyntaxError: Could not parse the remainder: ':password_change' from 'admin:password_change'. The syntax of 'url' changed in Django 1.5, see the docs. Here's part of my…
xpanta
  • 8,124
  • 15
  • 60
  • 104
73
votes
6 answers

How to test custom django-admin commands

I created custom django-admin commands But, I don't know how to test it in standard django tests
dixon
  • 1,265
  • 2
  • 9
  • 10
73
votes
7 answers

Can I make list_filter in django admin to only show referenced ForeignKeys?

I have a django application which has two models like this: class MyModel(models.Model): name = models.CharField() country = models.ForeignKey('Country') class Country(models.Model): code2 = models.CharField(max_length=2,…
m000
  • 5,932
  • 3
  • 31
  • 28
73
votes
13 answers

How to show all fields of model in admin page?

here is the models page In this picture, only the title shows up on here, I used: def __unicode__(self): return self.title; here is the each individual objects How do I show all these fields? How do I show all the fields in each Model page?
iCodeLikeImDrunk
  • 17,085
  • 35
  • 108
  • 169
71
votes
8 answers

Can you change a field label in the Django Admin application?

As the title suggests. I want to be able to change the label of a single field in the admin application. I'm aware of the Form.field attribute, but how do I get my Model or ModelAdmin to pass along that information?
Josh Smeaton
  • 47,939
  • 24
  • 129
  • 164
69
votes
2 answers

Force django-admin startproject if project folder already exists

I want to start new django project in already existing folder and obviously get CommandError: '/home/user/projectfolder' already exists. Is there some way to force startproject command to create project in an existing folder? I have some important…
valignatev
  • 6,020
  • 8
  • 37
  • 61
69
votes
3 answers

How do I add a custom column with a hyperlink in the django admin interface?

I have a django admin interface and in the model listing I want a custom column that will be a hyperlink using one of the fields values. Basically one of the models' fields is a url and i'd like the column to have that URL in a clickable hyperlink.…
mikec
  • 3,543
  • 7
  • 30
  • 34
68
votes
11 answers

How to check (in template) if user belongs to a group

How to check in template whether user belongs to some group? It is possible in a view which is generating the template but what if I want to check this in base.html which is an extending template (it does not have it's own view function)? All of my…
Milano
  • 18,048
  • 37
  • 153
  • 353
68
votes
6 answers

Remove default apps from Django-admin

By default, in Django-admin there is Users, Groups, and Sites apps. How can I remove Groups and Sites? I tried to remove admin.autodiscover() from root urls. Then, when I added something like admin.site.register(User, UserAdmin) somewhere in my app…
Anton Koval'
  • 4,863
  • 5
  • 31
  • 44