django-admin

Django admin site: implement a singleton for global variables?

Does anyone have experience (Django 1.x pref 1.3) with implementing a sort of singleton accessible from the admin page to expose some global variables for editing (site name, keywords, ...). I cant find anything like this and it sounds quite unbelievable! thanks (django-preferences is broken with 1.x) ...

Django admin site: How does the Add User page works (more fields on edit) ?

I was wondering how they made it possible to display more fields in the User page of the djagno admin site. If you create a new User you only have some basic fields to fill in but if you reopen that user (edit mode) then you see a lot more fields to fill in. Im trying to achieve the same, I had a look at the add_form.html template but I...

django newbie - creating fixtures data from manually entered data

I have finally got my admin part of my django site working. I am now beginning the tedious part of manually entering the initial data into the database. Obviously, I want this to be a one time affair. Can anyone suggest to me how I can create fixtures data from my manually entered data, so that I can reload the data (automatically?) wh...

Django Admin: Add TinyMCE to particular TextField only?

Hello, I have set up TinyMCE to work with the Admin panel (as per the instructions in the Django Docs http://code.djangoproject.com/wiki/AddWYSIWYGEditor ) The problem is that I have Inlines and other text areas within my model for which I don't want TinyMCE to render Does anyone know how to set TinyMCE to only load for particular fiel...

How can I add media (js and css) to my modelformset in Django?

Hey, I'm trying to add an Export CSV function to Django Admin. So far I've managed the following: 1. Added an 'Export CSV' link to the admin change_list.html. 2. On the export page, I start off by creating the required model from two separate parts of the URL using model = get_model(app_name, module_name). 3. From this model I first cre...

Django GenericForeignKey Widget: Using the value of one field inside another's widget

I have a GenericForeignKey in an inline on an admin page. Being a GenericFK there are 2 fields involved in it: The ContentType FK and the object_id integer field. The GenericFK can, of course, point to a variety of models and objects, some that have image fields and some that don't. My goal is to customize one of the widgets (it can be e...

Change Form Validation for Admin Login in Django

I use a custom auth backend in my django application that allows users to login with ther emails. But when I try to login in the admin I get the message: "usernames cant contain the '@' char" I suppose this error is raised before it reaches the auth backend, so its a form issue, right ? ...

Is it possible to use django-admin's "raw_id_fields" for a field other than 'id'?

If you have tens of thousands of objects, raw_id_fields is necessary. But knowing the ID of any specific object is not realistic. However most people would be able to remember the keywords of an object's slug, or in my case, maybe a unique 'sku number'. Is there a way to make 'raw_id_fields' search by sku or slug? ...

Idiosyncracy while extending django admin template

On my django site, I decided to just use the admin templates for the UI, but I made a few tweaks like the site name, color, etc. even my custom views just extend admin/base_site.html I did this by creating templates/admin/base_site.html with the following code: {% extends "admin/base.html" %} {% load i18n %} {% block title %}{{ title }...

Django admin: How to display a field that is marked as editable=False' in the model?

Even though a field is marked as 'editable=False' in the model, I would like the admin page to display it. Currently it hides the field altogether.. How can this be achieved ? ...

Import csv data into database in Django Admin

I've tried to import a csv file into a database by tweaking the modelform inside the admin doing this: models.py: class Data(models.Model): place = models.ForeignKey(Places) time = models.DateTimeField() data_1 = models.DecimalField(max_digits=3, decimal_places=1) data_2 = models.DecimalField(max_digits=3, decimal_place...

Django administration view: how to remove auto generated permissions?

Hello. Django administration view automatically generates permissions for all modules and tables - admin, auth, contenttypes etc. Is it possible to remove this permissions from 'Available user permissions' so i can see only permissions that i think are relevant? ...

Django textarea widget <p>

In django admin I am using the textarea widget. When I save data, it is saved inside a <p></p> tag. I dont want this - any solutions, I just want to get the data out without being wrapped in a <p>. Any suggestions? ...

Django ImageField: files dont get uploaded...

Hello, I implemented some ImageFields in my model and installed PIL (not the cleanest install). Things seem to work as I get an upload button in the admin and when I call the .url property in the view I get the string with the filename + its upload property. The problem is that the file is not there, apparently it doesnt get uploaded onc...

Django: Field.to_python not called on foreign key IDs?

I've got a subclass of Field: class MyIDField(Field): ... def to_python(self, value): return to_base_36(value) And I use it as a primary key like this: class Foo(m.Model): id = MyIDField(primary_key=True) class Bar(m.Model): foo = m.ForeignKey(Foo) Then the MyIDField.to_python function isn't called when I a...

How can I change the way the foreign key field is displayed in django admin?

Hi, My models look like this: Location: state county city street Building: name location = ForeignKey(Location) Now, in admin, when editing the Building, I want to have the ability to edit the Location in this way: So, it's like an inline, but with having Location in Building, not the oposite way. ...

prepopulate an admin field from logged-in User

How do I prepopulate an Admin field from logged-in User info? I have model.py: from django.db import models class News(models.Model): title = models.CharField(max_length=65) body = models.TextField() author = models.CharField(max_length=55) and I have admin.py: from django.contrib import admin from django.contr...

django admin - add extra tickboxes for use with action dropdown

I want to use the django admin app to connect two records (as a parent and child). Using the admin actions guide here: http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/ I have wrote a function which almost does this by utilises the actions dropdown (on the list view). What I have is the user ticks two records and then se...

Create a Django Admin Action to Duplicate a Record

I want to create a Django Admin Action that allows me to create a duplicate of a record. Heres the use case. Admin clicks the checkbox next to a record in an app that they want to duplicate. Admin selects "Duplicate" from the admin action drop down menu. Admin clicks go. Django admin creates a duplicate record with a new id. Page is re...

Django admin/doc/views/ all blank or broken

I'm trying to use Django's built-in admin docs feature to make writing templates easier. Supposedly if you go to /admin/docs/views you should get documentation for every view in your application. I see a list, but none of the links work: -) Any view listed that's related to my application just goes to a blank page with nothing but the n...