django-admin

Is there a way to express Django admin settings inside the models, instead of admin.py?

Talking about Django 1.1.1. I thought at one time (0.96) the kinds of things put inside of the admin.py file were part of an inner class of the model. There's a certain beauty in having all of this in one place. But I don't know if this change was out of necessity. Any compelling reasons one way or the other? ...

Displaying dates nicely in Django's admin interface

With methods on your model that return boolean values, you can mark them as boolean so the admin's list displays show the pretty icons, like this example from the docs: class Person(models.Model): birthday = models.DateField() def born_in_fifties(self): return self.birthday.strftime('%Y')[:3] == '195' born_in_fiftie...

Foreign Key relation does not populate in Django admin

Using django 1.0.1 on windows xp and postgres database I have a very strange problem in the Django admin page. Using the model and admin below, the field "balance" does populate with objects from the Balance model. However, it does NOT populate the locationparameter field: the name "locationparameter" does appear, but there is no pull-d...

Issue with ManyToMany Relationships not updating inmediatly after save

I'm having issues with ManytoMany Relationships that are not updating in a model when I save it (via the admin) and try to use the new value within a function attached to the post_save signal or within the save_model of the associated AdminModel. I've tried to reload the object within those functions by using the get function with the id...

Django Admin: not seeing any app (permission problem?)

I have a site with Django running some custom apps. I was not using the Django ORM, just the view and templates but now I need to store some info so I created some models in one app and enabled the Admin. The problem is when I log in the Admin it just says "You don't have permission to edit anything", not even the Auth app shows in the ...

How to set up Django admin.TabularInline on a table with a compount key.

I've essentially got two tables: Page(PK=url) and PageProperty(PK=url+name). Here is how I have my Models set up: class Page(model.Model): url = model.CharField(primary_key=True, max_length=255, db_column='url') #..... class PageProperty(model.Model): # table with compound key (url + name) url = model.ForeignKey('P...

Django admin site reverse ForeignKey inline

I have these models: (pseudocode) Course: ForeignKey(Outline, null=True, blank=True) ForeignKey(OutlineFile, null=True, blank=True) Outline: //data OutlineFile: //different data The situation is that any course can have an Outline associated with it, and/or an OutlineFile, or neither. An Outline can be asso...

Django: structuring a complex relationship intended for use with built-in admin site

Hi, I have a fairly complex relationship that I am trying to make work with the Django admin site. I have spent quite some time trying to get this right and it just seems like I am not getting the philosophy behind the Django models. There is a list of Groups. Each Group has multiple departments. There are also Employees. Each Empl...

django, runserver_plus - admin media files served from wrong path

The configuration below works fine on my remote host (same dir structure, same django), all admin media are served properly settings MEDIA_ROOT = '%s/static/' % FS_ROOT STATIC_DOC_ROOT = '%s/static/' % FS_ROOT MEDIA_URL = '/static/' ADMIN_MEDIA_PREFIX = '%smedia/' % MEDIA_URL urls (r'^admin/', include(admin.site.urls)), (r'^static/(...

How to preserve filter selection after save in Django Admin

First, I did look at this question, but its over a year old. Surely now there is a good way in Django 1.1.1 to carry filter selection forward after a user clicks the save button in the Admin. In a table with thousands of records, filtering is essential. And if a user makes several filter choices that effort shouldn't have to be repeat...

How can I modify the queryset in the change list view depending on a parameter I set in the URL

Hello, My problem is the following and it is related to the change list view of the admin interface. I have a workorder model with several fields to caracterize the work order. They are : type, nature, scheduling_type (and others). When I see the list view, I would like to be able to change the filter (thus be able to create complex ...

Implement auto_current_user_add when using Django's User table

I have an AppEngine app that I'm migrating to run in Django, using app-engine-patch to get all the goodness of Django - particularly the Admin interface. One of my models looks like (partially) this: class Request(db.Model): requestor = db.UserProperty(auto_current_user_add=True) When I display a form based on this model I don't di...

Why does Django admin try to encode strings into ASCII rather than Unicode? Or is this error something different than it looks like?

I've got the following error: TemplateSyntaxError at /admin/results_cop/copsegmentresult/ Caught an exception while rendering: ('ascii', 'ISU European Figure Skating Championships 2009: Senior Ladies Ladies: Short Program - 2. Susanna P\xc3\x96YKI\xc3\x96', 98, 99, 'ordinal not in range(128)') The fragment of the s...

Apps won't show in Django admin

I've read all the other threads but I still don't get why my apps are not showing up in Django admin. Everything else works fine. My apps are in settings.py I have admin.autodiscover in my root urls.py file from django.conf.urls.defaults import * from django.conf import settings from django.views.generic.simple import direct_to_templ...

unicode error when saving an object in django admin

Hello, In my django app, I have some objects that cause the corresponding URL in the django admin to be non ascii. (for example: http://mysite/admin/myapp/myclass/Présentation/) I can edit the object without any problem but when I save it I have the following error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in p...

Is it possible to create an end-user facing site using Django admin alone?

I'm very new to Django, having never developed on it. I'm trying to develop a site which has functionality exposed only to authenticated users (typical enterprise thing: for this discussion, let's say it's a private blogging platform). The functionality I'm looking for is: Users can create a new blog. each user can belong to multip...

POST request returns back to admin index page with "You don't have permissions to edit anything"

I am overriding the admin index.html template by adding at the end: <h1>Exporting and Validating Users</h1> {% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} {% if export_message %} <p><strong>{{export_message}}</strong></p> {% endif %} <table> <tr> <td> <form action=...

How to add 'collapse' to a Django StackedInline

In the same way you can add 'classes': ['collapse'] to one of your ModelAdmin fieldsets, I'd like to be able to have an Inline Model Admin be collapsible. This ticket, Collapse in admin interface for inline related objects, discusses exactly what I want to accomplish. But in the mean time, what's the best work around while we wait for ...

Django admin search

I have a simple Django admin app with a search box that searches by last name. Then I filter by school and sort by year graduated to find lawyers that graduated from same school the same year. I want to simplify this three step process to a single search: enter lawyer last name and return other lawyers that graduated from same school the...

What do I need to do to port an admin application to frontend?

I have a simple admin database. I want to port it to search and results pages. How do I achieve this? Thanks EDIT re Jonathan Fingland's comment from django.db import models class Lawyer(models.Model): firm_url = models.CharField('Bio', max_length=200) firm_name = models.CharField('Firm', max_length=100) first = models....