Project

General

Profile

Feature #149

Embed templatetag javascript

Added by Stephen Burrows almost 13 years ago. Updated over 12 years ago.

Status:
Resolved
Priority:
Normal
Category:
Admin
Target version:
-
Start date:
06/07/2011
Due date:
% Done:

0%

Estimated time:

Description

We shouldn't expect users to learn our special secret code. All TemplateFields (like on a blog) should come with a smidge of javascript that lets them perform a lookup and inserts the content type and pk of their selection wrapped in an embed tag into the TemplateField's content.

History

#1

Updated by Stephen Burrows almost 13 years ago

  • Assignee set to Harris Lapiroff
#2

Updated by Harris Lapiroff almost 13 years ago

Having some trouble with this one. My current idea was to open a new window—like the related object selector window—that would display a change list. Here's the trouble:

The view for change lists has the javascript callback function coded into the python for the change list template tag (https://github.com/django/django/blob/master/django/contrib/admin/templatetags/admin_list.py#L219).

I can rewrite those links client-side using javascript, but I can only do that the first time the window is opened. I.e., I can't rewrite those links if they need to create a new object, go to the second page, or search for an object.

I could override the changelist template, but that would require duplicating an modifying the template tag.

I could use a custom template and a custom view, but that would lack similarity to the rest of the admin interface and I'm not sure yet how I would hack on those URLs... ModelAdmin subclass? Instruct people to include philo.admin.urls or similar in their urlconf before admin.urls? None of these are particularly elegant solutions and they all seem like overkill for a feature that amounts to a minor custom widget.

This (http://groups.google.com/group/django-developers/browse_thread/thread/e9275e47693edc3f) would fix this problem (I'll open a ticket for it in a couple days if the other dude doesn't) but it would be nice to have a stopgap between now and getting a patch like that approved and released.

... Thoughts?

#3

Updated by Harris Lapiroff almost 13 years ago

  • Status changed from New to In Progress

Look into overloading the dismiss related popup function according to this method (http://groups.google.com/group/django-developers/msg/8b8b5ea597d43146) and using conditionals to determine whether a raw_id_field button or an embed button was pressed.

#4

Updated by Stephen Burrows over 12 years ago

  • Status changed from In Progress to Resolved

This was merged into develop with commit 6dc154ec98d58159b3e75447ce7b7fe5642acec4.

Also available in: Atom PDF