Feature #149
Embed templatetag javascript
0%
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
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?
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.
Updated by Stephen Burrows over 12 years ago
- Status changed from In Progress to Resolved
This was merged into develop with commit 6dc154ec98d58159b3e75447ce7b7fe5642acec4.