django-admin

Django admin search: how to override the default handler?

I wish to customize the way in which search queries across the search_fields. Is there a way to do it without hacking deeply into the Django code or creating a totally independent view? For instance, I would like to return the union of the querysets for each of the items of the querystring.split(). So that searching for "apple bar" wou...

How can I create sophisticated Django Model Validation for Django Admin?

I have the following model in Django: class Bout (models.Model): fighter_1 = models.ForeignKey(Fighter, related_name="bout_fighter_1") fighter_2 = models.ForeignKey(Fighter, related_name="bout_fighter_2") winner = models.ForeignKey(Fighter, related_name="bout_winner", blank=True, null=True, help_text='Leave blank fo...

Django Admin: Allow email as a username?

I've recently inherited a django project and I'm facing a serious amount of bugs/issues and ...quirks that need to be fixed. As I'm coming from a php background (don't ask), I'm having a ...challenging time. In terms of the Django admin, It will not accept any email address as a username. However, IN our front-end - the previous develop...

Django and FeinCMS: A way to use the Media Library in other normal models?

I'm using Django and FeinCMS on a project. I'm currently using FeinCMS for all the pages on the site. But I also have another separate model that handles very simple stock for the site too. This stock model has the usual fields (name, description, etc) but I also want it to have photos. Because FeinCMS has a media library already, I wou...

Replace "this field is required" message in django admin

Hi, is there a way to replace the default error message in django admin. I'm using custom widget so I have the form and I was wondering is there something like: field_1 = forms.Charfield(widget=X, error_messge='y') I already tried to add claen_field_1 method but it looks that it is not called when the field is empty. Any ideas will...

How to check value transition in Django (django-admin)? (Revisited)

I was wondering about how to control transitions in model data. I found the solution at http://stackoverflow.com/questions/867120/how-to-check-value-transition-in-django-django-admin but when I tried to implement it within my code, something went wrong (I am able to change the status with impunity): Here is the relevant portion of my ...

Using list_filter with an InLine model in Django

Hello, We are having problems getting the filtering in the admin interface working the way we would like it to. We have the following: models.py: class Person(models.Model): first_name = models.CharField(blank=True) last_name = models.CharField(blank=True) class Affiliation(models.Model): person = models.ForeignKey(Person) a...

Django many-to-many problem in admin

I am essentially creating a blog application in django as a way of learning the ropes and boosting my skill level in django. I basically have a many-to-many relationship that I am having problems with in the admin site. I have two main types, Article and ArticleTag. Many Articles can belong to many ArticleTags, and the relationship shoul...

Extending Django-Admin Login (username, password, sites)

Hi, I'm trying to extend Django Admin Login. Most of the resources pointed towards extending views after the Login. I wanted to add sites to the Login criteria. So instead of Username Password It will be Username Password Site Such that the Site will check whether the user belongs to the Site as admin and if it is, it will l...

Loading inline objects using ajax in django admin.

I have a setup where I can upload many pictures at once inline and it looks like this: This works perfectly. And I can also reorder them with jquery sortable Here is the related code so you see what's happening: class PhotoInline(admin.StackedInline): model = Photo extra = 0 form = PhotoModelForm fieldsets = ( ...

Using arbitrary methods or attributes as fields on Django ModelAdmin objects?

Using Django 1.1: The Django admin docs describe using arbitrary methods or attributes on a ModelAdmin object in the list_display class attribute. This is a great mechanism for displaying arbitrary information in the list display for a Model. However, there does not appear to be a similar mechanism for the change form page itself. What ...

how know where is the error?

Hi guys, im using a django app (django adzone), well, but im trying to add banners, and django zone tell me " please fix the errors" , but nothing more, i cant see where are the errors. any idea how ill know ? EDITED There's not trace about the error or something like that, is just a django admin message see the images thanks ...

Django admin action with file upload - process file content and put it in database

Hi, I want to add some functionality in admin that allows me to upload file and the process it. I already have a model that I can edit trough the admin, but I want to be able to "upload" multiple items with this file processing. How can I achieve this in the admin? ...

Django: Update Field Value Based on Other Fields

I am not sure this is even possible without modifying the Admin interface. I have a model called "Quote" that can contain multiple "Product" models. I connect the two using an intermediate model "QuoteIncludes". Here are the three models as they currently stand: class Product(models.Model): name = models.CharField(max_length=100) ...

Django can't find my non-python files!

I can't, for the life of me, get Django to find my JavaScript files! I am trying to plug in a custom widget to the admin page, like so: class MarkItUpWidget(forms.Textarea): class Media: js = ( 'js/jquery.js', 'js/markitup/jquery.markitup.js', 'js/markitup/sets/markdown/set.js', 'js/markitup.init.js',...

Django - Search related fields

My models: class Contact(models.Model): first_name = models.CharField(_("First name"), max_length=30, ) last_name = models.CharField(_("Last name"), max_length=30, ) email = models.EmailField(_("Email"), blank=True, max_length=75) class PhoneNumber(models.Model): contact = models.ForeignKey(Contact) phone = models.C...

How to add custom field header names on change list page of Django admin interface?

I'm building a django site with the admin site enabled on the backend. I want to change the names shown on the headers for the various model fields without actually changing the name of the fields. Is there an easy way to do this? I've browsed the django site and can't seem to locate this information. Anyone know if this can be done and...

django modeladmin list_display

I'm trying to play with the Django's official tutorial. Specifically the modeladmin list_display: http://docs.djangoproject.com/en/1.2/intro/tutorial02/#customize-the-admin-change-list How can I add a column that displays the number of choices for each poll in the list? Thanks! ...

django-admin.py launches IDE

I just went to create a new django project and I typed django-admin.py startproject my_project into the command prompt and it opened the django-admin.py file in my ide (komodo edit). This happens every time I run this command in any form, even if I just try django-admin.py. Any ideas what's going on and how I fix it? I'm on Win Xp wit...

Django - dumpdata truncate to last n lines.

Hi all, Does anyone have a simple solution to using (or modifying) dumpdata to trucate a simple table down to the last n lines. I like to use dump data for test fixtures but the data size has gotten so large this doesn't make sense. BTW - I didn't design the table I'm just the sucker which has to deal with it. For those who may ask h...