django-admin

Django ordered ManyToManyField in admin interface

I have a legacy database with tables for documents and authors. A third table defines an ordered many to many relationship between the documents and authors, using foreign keys to the documents and the authors and an integer to specify the author order for a given document. Using Django 1.1.1 (or SVN), is there a way to edit the documen...

Django Admin: OneToOne Relation as an Inline?

I am putting together the admin for a satchmo application. Satchmo uses OneToOne relations to extend the base Product model, and I'd like to edit it all on one page. It is possible to have a OneToOne relation as an Inline? If not, what is the best way to add a few fields to a given page of my admin that will eventually be saved into the...

Problems with updating records in django-admin

I'm using Django (specifically django-admin) to be the admin panel for a site that uses PHP for client-facing features. I've been messing around making the admin look exactly the way I want and so far so good. However, I've run into a few problems that I need solving. Here's the models that I'm working with: class Permissions(models.Mo...

Django ValueError at /admin/

Hello, I am running Django with mod_python on a Red Hat Linux box in production. A little while ago, for a reason unknown to me, the admin stopped working, throwing a 500 error. The error is as follows: ValueError at /admin/ Empty module name Request Method: GET Exception Type: ValueError Exception Value: Empty module name Exception L...

Django Admin - add collapse to a fieldset, but have it start expanded

Is there a way to make a fieldset collapsible, but start expanded? When you add collapse to the fieldset classes, it gets the functionality but starts collapsed. I've taken a look at the JS that shows/hides the fieldset content, but it doesn't look like there's anything in there to do what I'd like it to, so I'm assuming I'll have to r...

Django: Serving admin media files

Hi! I am trying to serve static files from another domain (sub domain of current domain). To serve all media files I used this settings: MEDIA_URL = 'http://media.bud-inform.co.ua/' So when in template I used {{ MEDIA_URL }} it was replace with the setting above. Now I am trying to serve admin media files from the same su...

Column/field level permissions in Django admin site?

Is it possible to implement column level permissions per user in the Django admin site? Its a small project and I only need two groups of permissions. In the docs I cant find anything out of the box however I was wondering if its possible to create two admin sites and use separate ModelAdmin.exclude or ModelAdmin.fields for each one? I...

Django: Altering model fields from admin views

Hi all, I would like to know how you can change a model's field's parameters, not during model initialisation, but from a model admin. For instance, I would like to make either field "foo" or "bar" optional, according on a get parameter (wondering about the correct solution for the # PSEUDO CODE bit): def add_view(self, request, form_u...

Inline multiple one-to-one fields in Django admin

I cannot get the admin module to inline two same field models in one-to-one relations. To illustrate it, I've made the following example, a model Person uses two addresses: class Client(models.Model): # Official address official_addr = models.OneToOneField(Address, related_name='official') # Temporary address temp_addr =...

Django Admin "Edit Selection" Action?

I'd like to write a django-admin action (for use when the user selects zero or more rows) that will allow them to edit the selected items as a group. I only need to edit one of the items in the model (the "room") at a time, but I don't want to have to go through all 480 of my objects and manually edit them one-by-one. Is there a way to ...

Django: Verbose name of related model not translated

Hi all, I am using ugettext to translate a Category model's verbose_name. This works fine in admin when adding new objects, however, when using Category as in a one-to-many relationship with Post, the Category's verbose_name is neither translated in the list filter nor the change form of Post. How can I correct this? ...

Hot to add the ability to search in UserProfile to UserAdmin in Django | search_fields w/ ForeignKey

Hi, I'm using Django's User management in combination with UserProfiles that are linked to the User model with ForeignKeys. Now, I'd like to make fields from the users' profiles searchable from the UserAdmin. My best guess was to user something like this: class UserAdmin(auth.admin.UserAdmin): def field_name(self, obj): r...

What to use for tagging in Django 1.1

Unless I'm missing something, it seems django-tagging (0.3) doesnt work on Django 1.1.x. I was having issues then search around and it seems to be the general concensious. What are other people using? Just in case here is all I'm doing. class Article(models.Model): title = models.CharField(max_length=200) tags = TagField() tag...

Django, Cannot assign None, does not allow null values

i have this models.py import datetime from django.db import models from tinymce import models as tinymce_models from filebrowser.fields import FileBrowseField class ItemWithMedia(models.Model): created = models.DateTimeField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) class Actual(ItemWithMedia): publ...

Allow null in foreign key to user. Django

I have this model class Vacancy(models.Model): user = models.ForeignKey(User, null=True, blank=True, default = None) name = models.CharField(max_length=64) When in admin i try to creat a vacancy without a user. And it throws an error " club_vacancy.user_id may not be NULL". Am i doing something wrong? ...

Django, how to generate an admin panel without models?

Hi, I'm building a rather large project, that basically consists of this: Server 1: Ice based services. Glacier2 for session handling. Firewall allowing access to Glacier2. Server 2: Web interface (read, public) for Ice services via Glacier2. Admin interface for Ice services via Glacier 2. The point I'm concerned with is the...

How to add a custom view to the Django admin without having a model in the application

I have an application without any models, but with some custom admin actions. Now I want to add a custom admin view to support the custom admin actions. In order to make the use of the application easy I only want to use the actions attribute in the ModelAdmin's that need these actions. The problem is: how do I add a custom view without...

Adding custom JS to a django admin field

In a django application I have the following model: class Appointment(models.Model): #some other fields #address fields zipcode=models.CharField(max_length=5) address=models.CharField(max_length=120) latitude=models.FloatField() longitude=models.FloatField() When I'm rendering an Appointment, I'm just putting a...

Differentiating Permissions in the Admin Between Editing and Viewing a Pop-Up

I have a Posting app which has, as an inline, FKs to a Gallery object. The idea being that while making a Posting, a user can click to add a Gallery object to the Posting. For that purpose, I am using a raw_id_field field to pop up the window for Gallery selection. My problem is that I don't want users to have access to modify or add Ga...

Django on Webfaction: Serving static admin media files - configuration

hi folks, I having trouble serving Django's static admin files on webfaction. Here's how I'm currently set up: I've created a 'Symbolic link to static-only app', and provided the link to Django admin files in 'extra info': /home/myusername/webapps/mydjangoapp/lib/python2.5/django/contrib/admin/media (cd'ing into that directory works ...