django-admin

Country/State/City dropdown menus inside the Django admin inline

I have a city foreign key in by BusinessBranch model. My City model also has a state and country foreign keys for State and County models. I'm having hard time displaying State and Country dropdown menus inside my BusinessBranchInline. What would be the best way to achieve this? It would be great if the dropdowns filter items based on th...

django admin inline formset override save

I have a model that looks like this: class ProjectImage(models.Model): big_thumb = ThumbnailField(upload_to='profiles', size=(500, 500)) med_thumb = ThumbnailField(upload_to='profiles', size=(300, 300)) small_thumb = ThumbnailField(upload_to='profiles', size=(100, 100)) I associate ProjectImage with a Project as a Tabular...

in Django admin how can I know a boolean is set true for the first time only

I have a model that contains a boolean field representing the item's approval or not. I'd like to send an email when the box is checked. I understand how to override the save method and send the email if it's true but this will send an email every time it's saved. As I only want to send the email once, is there a way to check a boolean...

Django limit_choices_to at circular relation

Hi, I've implemented a circular OneToMany relationship at a Django model and tried to use the limit_choices_to option at this very same class. I can syncdb without any error or warning but the limit is not being respected. Using shell I'm able to save and at admin I receive the error message: "Join on field 'type' not permitted. ...

'getattr(): attribute name must be string' error in admin panel for a model with an ImageField

I have the following model set up: class UserProfile(models.Model): "Additional attributes for users." url = models.URLField() location = models.CharField(max_length=100) user = models.ForeignKey(User, unique=True) avatar = models.ImageField(upload_to='/home/something/www/avatars', height_field=80, width_field=80) ...

Django inline edit of model with FilePathField

I have this simple setup: class Artist(Model): ... class Download(Model): artist = ForeignKey(Artist) title = CharField() file = FilePathField(...) and the admin looks like this: class DownloadInline(TabularInline): model = Download class ArtistAdmin(ModelAdmin): inlines = [DownloadInline,] I get a validation error fo...

Extending the admin panel in Django

I have several objects with some functions that I would like to be able to run via the admin panel. So far, I've not found a way to add them as actions to the admin interface. Is there a way to do it? ...

Can Django admin handle a one-to-many relationship via related_name?

The Django admin happily supports many-to-one and many-to-many relationships through an HTML <SELECT> form field, allowing selection of one or many options respectively. There's even a nice Javascript filter_horizontal widget to help. I'm trying to do the same from the one-to-many side through related_name. I don't see how it's much dif...

Django App Not Showing up in Admin Interface

I'm currently moving from my development server to an Apache web production server. I've tried doing the following just by copying it over and I can login to the admin panel but it doesn't show up. My admin.py in my app looks like this: import models from django.contrib import admin admin.site.register(models.Organization...

Weekly-based populating a database with the django admin

I'm building an small django app in order to manage a store employees roster. The employees are freelancers-like, they have weekly almost-fixed schedules, and may ask for extra ones at any weekday/time. I'm new to both python and django, and I'm using the django admin. Everything works fair enough (for me) when I "manually" add a "Turn...

Setting up permission to view list of objects without add/edit permission.

I want to let a few users to be able to access the django admin site, but in some models allow permission to only being able to view the list of objects. Is there an easy way of doing this or should I just create a view to show this information? ...

Editing both sides of M2M in Admin Page

Hello all, First I'll lay out what I'm trying to achieve in case there's a different way to go about it! I want to be able to edit both sides of an M2M relationship (preferably on the admin page although if needs be it could be on a normal page) using any of the multi select interfaces. The problem obviously comes with the reverse sid...

How do I make a Django Admin drop down list have a dependency on a search box?

I currently have a workable Django admin on the left mockup below but want it to look and function like the one on the right. Basically, I'm creating customized menu list every now and then but I have 1000 menu items to choose from. The pain is manually finding the item I want by scrolling through about 1000 items. I'm thinking of a...

in django admin, can we have a multiple select based on choices

http://docs.djangoproject.com/en/dev/ref/models/fields/#choices i've read through the documentation and this implies using a database table for dynamic data, however it states choices is meant for static data that doesn't change much, if ever. so what if i want to use choices, but have it select multiple because the data i'm usin...

Django Admin redirects not working ...

I am using the latest checkout of the django trunk - when I am in the admin on the "change" page for an object/item, there is a nice little link that says "view on site". The link points to a url such as: http://example.com:8888/admin/r/22/15/ However, when I click on that link (or enter that link into my browser) I get redirected t...

Inline editing of ManyToMany relation in Django

After working through the Django tutorial I'm now trying to build a very simple invoicing application. I want to add several Products to an Invoice, and to specify the quantity of each product in the Invoice form in the Django admin. Now I've to create a new Product object if I've got different quantites of the same Product. Right now ...

Remove "add another" in Django admin screen

Whenever I'm editing object A with a foreign key to object B, a plus option "add another" is available next to the choices of object B. How do I remove that option? I configured a user without rights to add object B. The plus sign is still available, but when I click on it, it says "Permission denied". It's ugly. I'm using Django 1.0.2...

Negative custom Django admin FilterSpec

I'm working on a custom Django Admin FilterSpec (covered already on SO #991926). My FilterSpec is a replacement for the default filter on ForeignKey(User), and basically replaces the list of all users with three only choices, all, mine, and others. For example, if I applied the custom filterspec to the field created_by it would add an ...

Django auto_now and auto_now_add

For Django 1.1. I have this in my models.py: class User(models.Model): created = models.DateTimeField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) When updating a row I get : [Sun Nov 15 02:18:12 2009] [error] /home/ptarjan/projects/twitter-meme/django/db/backends/mysql/base.py:84: Warning: Column 'crea...

Django Admin - Re-authentication?

I'm in a bit of a dilemma at the moment regarding Django's admin backend. The default authentication system allows already logged-in users that have staff privileges to access the admin site, however it just lets them straight in. This doesn't feel “right” to me, and I'm wondering if it would be difficult to at least require a re-authen...