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?
...
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...
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...
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...
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 ...
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...
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...
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...
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/(...
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...
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 ...
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...
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...
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...
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...
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...
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=...
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 ...
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...
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....