tags:

views:

148

answers:

2

Hi,

I am currently having an issue when using the raw_id_field within admin.py in my Django project.

My site's admin area has a number of image upload fields for various different model pages which are all ForeignKey fields to an Image model where all images for the site are stored. As the site will eventually be dealing with a large quantity of images (100s, maybe 1000s) the default select box would be unusable.

I created various admin.ModelAdmin classes e.g

class InfoSlideAdmin(admin.ModelAdmin):
    raw_id_fields=('image',) 

These change the image selector within my Edit pages from a Select Box to a Raw ID Field.

However when I select a different image using this control although the ID of the new image is shown the title from the previous image still displays.

Any ideas?

+1  A: 

The title is refreshed via Javascript when you close the pop-up window. It's possible that you have some sort of cross-domain issue which is preventing the JS from running - this does sometimes occur when you're running via the development server on eg port 8080.

Have a look at what the console in Firebug is showing you (you are using Firebug to debug Javascript problems, aren't you?).

Daniel Roseman
I do use firebug to debug issues such as this yes. However I normally use the "Net" tab and track which files are being called by the page as it loads. However you can only use the Net tab after a page refresh and this does not occur when using the raw_id control.
James Howell
A: 

I do use firebug to debug issues such as this yes. However I normally use the "Net" tab and track which files are being called by the page as it loads. However you can only use the Net tab after a page refresh and this does not occur when using the raw_id control.

James Howell