django-admin

customize django's admin: how to place stylesheet where you want it belong?

I tried to customize django's admin css....but I'm stuck ....i did find a lot of similar discussions here...still I'm not clear... here is what I see... In base.html, we have <link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/base.css{% endblock %}" the line resolves to...

Creating an inline admin which displays the final model instead of the GenericForeignKey link table.

The models below show a simple GenericForeignKey relationship. It has been set up in this way to allow an Image to be reused by any other model. class Image(models.Model): name = models.CharField(max_length=150) desc = models.TextField(max_length=400) resource = models.ImageField(upload_to='imgs/generic/%Y/%m/%d') def _...

Django: Display many-to-many fields in the change list

Django doesn't support displaying of related objects from a many-to-many relation in the changelist for a good reason. It would result in a lot of database hits. But sometimes it is inevitable and necessary to e.g. display an object's categories, which have a many-to-many relation to the object, in the changelist. Given that case, does ...

How do you guys protect django admin site?

I thought I might restrict it to show only on some IPs, but I have some freelance workers without static IPs that should be able to login to admin site. I rolled out a big project and I am looking for some ways to protect the admin site fom unwanted eyes. ...

django admin list_display invert (not) a boolean field

I have: class MyModelAdmin(admin.ModelAdmin): list_display = ('name', 'locked', ) It displays the nice green and red icons for the locked field. What I want is to show inverted values in locked field. So i wrote this: def not_locked(obj): return not obj.locked class MyModelAdmin(admin.ModelAdmin): list_display = ('name'...

Django admin site: how to create a single page for global settings?

I would like to create a single page in the admin site of django where I can change some global variables of the website (title of the website, items in the navigation menu, etc). At the moment I have them coded as context processors but I would like to make them editable. Something similar to what happens in WordPress. Is this possible...

Django inline for model inheritance target

Hi, I am trying to solve problem related to model inheritance in Django. I have four relevant models: Order, OrderItem which has ForeignKey to Order and then there is Orderable model which is model inheritance superclass to children models like Fee, RentedProduct etc. In python, it goes like this (posting only relevant parts): class Ord...

Adding an extra button to one object in django admin

I hope this hasn't been asked and I just missed it, but I searched a bunch and couldn't find anything. I'm adding an extra save button to the django admin when adding or changing an object. Doing that is fairly easy. I just overrode the submit_line.html to add the extra button and then overrode the save_model function to check for the ...

Django: Models: How can I make the app_label appear in all caps?

Hello - 2 questions... If I manually set my app_label, is there a way to set it to all caps? I am using an acronym for the app name and is a little confusing to not have it in all caps. If I set the app_label on a new project, were I have no users or data, what kind of issues should I look when setting up user permissions and database...

Using Pinax's STATIC_URL for custom widgets.

Hello Stack-ers, I've come across a case whereas I've been using WYMEditor in the admin to take care of my rich text editing needs. I've now implemented the site utilising the basic/zero Pinax project. It seems however, that now I need to re-route the media needs of the wymeditor widget to STATIC_URL instead of MEDIA_URL. Though I'm ...

django - 404 page displayed for dev web server (http://127.0.0.1:8000/)

I am familiarizing my self with django. I have succesfully installed and tested a demo site. I now want to switch on the admin module, to see what happens. This is the steps I took (granted, some were unnecessary, but I just wanted to make sure I was starting from a clean slate): Edited mysite/settings.py to enable admin Edited mysit...

How to use 2 diffrent authentications in a django-powered site?

I currently manage a website, coded in django, that has 2 standard areas - the frontend and backoffice (which is built using django's admin interface). Recently the customer claimed he wanted 2 diffrent authentications - one for frontend users and another one - for people managing the backoffice. Until now they both used standard djan...

Grid view with textbox & link button in footer in two different row.

Hi, I have to display a gridview with blank textbox in one footer row and link button in another footer row. When i'll click on the link button it should display new row with blank textbox in the column. I'm using .net 2005. Thanks in advance. ...

Django admin site: how to include conditional fields?

Hello, I wonder if is it possible to add some conditional fields in django. Say I have a category model which has an ID, name and description fields. What I would like is to add a many-to-many field in my Product model that links it with the Category ID model... and as a helping reference show what the name of that Category would be. I k...

Non-public image upload

By default, Django uploads images to the MEDIA_ROOT setting, which is assumed to be a publicly accessible directory. I don't want users to be able to upload images and to have those images immediately accessible. Instead, I want the images to be uploaded to a non-public tmp directory. Later on, a site moderator will approve images in ...

Django admin site: how to compute field from multiple fields value?

I am wondering if is there a way to compute a field in the admin site based on a concatenation of multiple fields. Basically I have a Product model with different fields associated to various attributes (colour, size, length etc). I would like to compute the code value to be a concatenation of the values of the various attribute field...

geodjango access violation on vista 32 bit

Am having a real problem with the geodjango saving an entry. It produces a "Error: Access Violation reading 0x???????" The error does not indicate which file or folder it's trying to gain read/write access to. Upon researching i found other non-django programs that also have this issue, some were fixed by turning off Vista's DEP control...

Django admin site: prevent fields from being edited?

Hello, is it possible to prevent certain fields to be edited after they've been saved? They should be editable when the user creates a new item of a certain model but then when they try to open them to edit certain fields are 'blocked'. thanks ...

Django: Why when using auto-populate from a manytomany or foreignkey field I always get the ID?

The title says it all or almost... I have a slug field that I would like to be auto-populated from a value in a manytomany. It kind of works as it displays in realtime the ID of the selection in the manytomany field. The model of the manytomany field has its own def unicode(self) to return a string value with its name but this doesnt app...

Anyone with experience on django-preferences app or similar?

Hello, Im still trying to embed a page in my admin site where I can let the user to change some global variables (like in wordpress) such as the site name, meta keywords, etc. Apparently there is an app that does this but I cannot get it to work (Im using Django 1.3): http://github.com/praekelt/django-preferences NOTE: I tried both fro...