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

How to integrate imagekit with S3

I would like to upload from django admin app photos to S3 and associate them with my model. I have found imagekit very appropriate for this. How can I configure imegekit to upload photos to S3 server?
Vladimir Nani
  • 2,774
  • 6
  • 31
  • 52
4
votes
1 answer

Displaying model's docstring in admin app

In Django admin, help_text attribute for individual fields is displayed to give instructions. However, I would like to include a similar feature for the whole models. In the code, I'm using docstrings to keep general instructions about models, and…
Berislav Lopac
  • 16,656
  • 6
  • 71
  • 80
4
votes
2 answers

Django Logout Button

This may seem like a silly question but I can't find anything to help. How would you create a logout button on every view like the one available in the admin page?
JohnnyCash
  • 1,231
  • 6
  • 17
  • 28
4
votes
2 answers

Rich text editor in Django admin - Hiding the HTML tags in the change list

I am developing a Django project where admins are able to style some content using TinyMCE. Everything works fine, except for an annoying detail. For some model it happens that a field edited in rich text mode needs to be shown in the change list.…
Andrea
  • 20,253
  • 23
  • 114
  • 183
4
votes
1 answer

Image and video previews in admin inline forms for ManyToMany relation

A have 3 models: Project, Image and Video with ManyToManyField relation: class Project(models.Model): images = models.ManyToManyField('Image', through='Project_Images') video = models.ManyToManyField('Video', through='Project_Video') class…
ramusus
  • 7,789
  • 5
  • 38
  • 45
4
votes
1 answer

How to add custom validation on a list display form

I have a model in which the is an option for setting if an element is active or not. There is restriction to the number of elements that can have the "active" property with a "True" value. I have writen validation code on the AdminModel. So now if…
sandok
  • 53
  • 7
4
votes
1 answer

Django admin extra field Sum() TimeField

In Django Admin i want to display the sum of all action durations. I solved it wirh an extra field. But the sum of 01:30:00 h 03:45:00 h are summed to 47500,0 because sum converts times to integer. I changed my admin.py like it is described here:…
surfi
  • 1,451
  • 2
  • 12
  • 25
4
votes
2 answers

Django: how to map the results of a raw sql query to model instances in admin list view?

Consider the simple model: class Item(models.Model): name = models.CharField(...) unit_cost = models.DecimalField(...) unit_price = models.DecimalField(...) It has the following admin class: class…
Rabih Kodeih
  • 9,361
  • 11
  • 47
  • 55
4
votes
1 answer

Can a Django model automatically fill in the current authenticated user from the admin interface?

I'd like to be able to include a reference to the currently authenticated user with a Note when working with Notes from the admin interface. The model would look something like: from django.db import models from django.contrib.auth.models import…
pkropf
  • 51
  • 4
4
votes
3 answers

manage.py: cannot connect to X server

I have used PyQt4.QtWebkit to crawl the web page in my django application.In the production environment that module doesn't work to crawl it.it throws the error "manage.py: cannot connect to X server" My Qt class : class Render(QWebPage): def…
Nava
  • 6,276
  • 6
  • 44
  • 68
4
votes
2 answers

django admin - access request.user in BaseInlineFormSet

I've just created a forms.models.BaseInlineFormSet to override the default formset for a TabularInline model. I need to evaluate the user's group in formset validation (clean) because some groups must write a number inside a range (0,20). I'm using…
Ale A
  • 349
  • 5
  • 16
4
votes
5 answers

Assigning initial field values in bound Django admin forms

I have a fairly simple Django application (v1.3 on Red Hat) for which I'm using the admin application to create and modify database records. One of the fields in my underlying model is a date field. Each time the corresponding field is displayed in…
Phil
  • 243
  • 1
  • 4
  • 8
4
votes
2 answers

How to display multi-word app names properly (i.e. with spaces) in Django admin?

I'm struggling to find a way to get multi-word app names to display properly in Django admin. I've tried CamelCasing, hyphens and underscores, but in each case the app name just displays in admin exactly as it's named in the project. I've searched…
matt
  • 43
  • 5
4
votes
4 answers

Django - Add an extra field to an inline form in admin interface

Suppose I have the following in admin.py: class ImageInline(admin.TabularInline): model = Image class ObjectAdmin(admin.ModelAdmin): inlines = [ ImageInline, ] How do I add an extra field to ImageInline that is not a field in Image model?
Aziz Alfoudari
  • 5,193
  • 7
  • 37
  • 53
4
votes
2 answers

How to display a value where there is none in Django admin?

Is there a Djangotastic way to display a default value for a field in the admin when there isn't a value? Like 'n/a', but not to save that to the database? When I set all the fields in the model below to readonly in the admin, the front-end display…
jackiekazil
  • 5,696
  • 4
  • 21
  • 20