django-admin

Can you recommend a good django file manager for the admin?

I'm looking for a robust, stable django file manager for use in the django admin. My requirements wish list: Allows browsing and selecting files on the server (e.g. images) Allows uploading files. Multiple file upload would be great (with, e.g. uploadify) Does not require me to use a custom field in my model definitions (like django-f...

Pre-Filling a ForeignKey from a link to the Admin?

Some introduction. I have a "planet-like" feed aggregator with an extra layer on top. That extra layer allows for comments and elaboration on the aggregated posts. Here's some code for reference. class Post(models.Model): title = models.CharField() published = models.DateTimeField() class Story(models.Model): title = models...

Django Newbie ManyRelated Manager not Iterable Question

Hello, I'm trying to create a product code (in the admin) by combining elements from two other fields - one of which is a ManyToManyField. I'd like to iterate through that field to find out if a specific product option has been chosen, and append a variation of it to that non-editable product code, like so: class ShirtColorClass(models...

Django admin changelist - restrict where field is NULL

I'm setting up a new Django app and need to customize the Admin for a given table by restricting the records where a field is NULL. Basically a built-in, permanent filter. Seems like changelist_view needs to be overridden, but I'm uncertain what that change would look like. There's no code to be included as I'm not overriding changeli...

Django ModelAdmin.save_model() changes not committing to database

I have a many to many relationship between Group and User and also between User and Domain. Also i have one to many relationship between Domain and Group. I have defined the save_model function of UserAdmin as follows: def save_model(self, request, obj, form, change): form.save(False) obj.save() form.save_m2m() ...

How to modify the rendering of a wdget in admin template?

I am trying to overrride the "admin/includes/fieldset.html" template. I am rendering "Group", a ModelMultipleChoiceField field as a CheckboxSelectMultiple widget. However I want to change the display depending on the choices selected. {% if field.is_checkbox %} {{ field.field }}{{ field.label_tag }} {% else %} ...

New field in Django model doesn't show up in admin interface or model forms

I've created a model in one of my apps which works fine. However, I needed to add a new field. I did this, and used manage.py reset <appname> to drop the tables and add them again. This process went fine - the new field appears in the database. However, I can't get the field to show up in the admin interface, nor in the custom model form...

Custom Django admin widgets for many-to-many relations

Let's say I have the following Django models with these ForeignKey fields (simplified syntax): class Container(Model): items -> Item sub_items -> SubItem sub_sub_items -> SubSubItem class Item(Model): container -> Container children -> SubItem class SubItem(Model): container -> Container parent -> Item ...

Django admin does not show all entities

Hello! I've inherited an app created with Django. There is a problem with it: in admin interface, the page lists not all entities (videos), but some (16 of 25). I have no idea, what is this. Then I run python manage.py shell, and there Video.objects.all(), there are all 25 objects (counted them using len and by iterating them with for ...

widgets in django admin

I need a widget which can make a foreignkey readonly and also it should display the value related to that field not the id suppose Class A(models.Model): id=models.AutoField(primary_key=True) name=models.CharField(max_length=200) def __unicode__(self): return self.name Class B(models.Model): id=models.AutoField(pri...

POSTing forms in Django's admin interface

I'm writing a Django admin action to mass e-mail contacts. The action is defined as follows: def email_selected(self,request,queryset): rep_list = [] for each in queryset: reps = CorporatePerson.objects.filter(company_id = Company.objects.get(name=each.name)) contact_reps = reps.filter(is_contact=True) ...

Django ForeignKey issue

I have two classes class A(models.Model): id=models.IntegerField(primary_key=True) name=models.CharField(max_length=200) store_id=models.IntegerField() type=models.ForeignKey(B) class B(models.Model): id=models.IntegerField(primary_key=True) type=models.CharField(max_length=10) class C(models.Model): id=mo...

Django admin, filter objects for inline formset

I've got an inline formset and I would like to exclude some model objects from being displayed in the formset. For eg. there is model B which has foreign key to model A, so it is a 1:n (A object has many B objects) relationship. Now on A admin edit page I've got inlines of B. I wonder if it is possible somehow to filter the list of B o...

Search_fields in django python

I was wondering how I am able to use a foreign key to preform a search for example class Product(models.Model): name = models.CharField(max_length = 127) description = models.TextField() code = models.CharField(max_length = 127) def __unicode__(self): return self.name + " - " + self.code class ProductLot(models...

Different authentication backend for the django admin

What would be the best solution to use a different authentication backend for the Django admin site? ...

Optimizing ModelChoiceField query in django Admin (AppEngine)

I have two models: Activity and Place. The Activity model has a ReferenceProperty to the Place model. This was working fine until the Place table started growing and now when trying to edit an Activity via django admin I get a memory error from Google (it doesn't happen if I remove that field from the Activity admin's fieldsets) The wi...

Math functions as well as flags

from django.db import models from django.contrib.auth.models import User class Product(models.Model): name = models.CharField(max_length = 127) description = models.TextField() code = models.CharField(max_length = 30) lot_no = models.CharField(max_length = 30) inventory = models.IntegerField() commited = models.IntegerField() available ...

Math and change field color

from django.db import models from django.contrib.auth.models import User class Product(models.Model): name = models.CharField(max_length = 127) description = models.TextField() code = models.CharField(max_length = 30) lot_no = models.CharField(max_length = 30) inventory = models.IntegerField() commited = models.IntegerField() reorder = ...

django-grappelli and rare lot of errors

I'm using Django-grappelli in my project, but Django is send me a lot of errors to my email about some files that Django didn't found...but I don't know from where is calling this files...some time files .aspx (??) Here is a image with the error list in my inbox Here is a error detail: Traceback (most recent call last): File "/home...

Django InlineModelAdmin: Show partially an inline model and link to the complete model

Hi everybody I defined several models: Journals, volumes, volume_scanInfo etc. A journal can have more volumes and a volume can have more scanInfo. What I want to do is: in the admin page of journals I want to have the list of the volumes inline (done) connect each volume of the previous list to its admin page where I can show the fo...