- December 29, 2009
- Not specified
- admin jquery raw_id_fields
- 0 (after 0 ratings)
The Django Admin site provides a "raw ID" feature for foreign keys that reference large tables. In the form view, the label of the referenced object will appear after the input. This snippet will make that label into a hyperlink that takes you to the form view for that object.
To use this snippet, copy base_site.html into your templates/admin directory (if you haven't already), and paste this code into that file somewhere after the 'extends "admin/base.html"' directive. If you are already using jQuery, you can remove the first script tag. If you are already extending "extrahead", just paste the script tag(s) into the block you have created.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
More like this
- Hyperlink read-only ForeignKey objects in admin to their change pages by strangefeatures 3 years, 7 months ago
- Link raw_id_fields (both ForeignKeys and ManyToManyFields) to their change pages by EmilStenstrom 4 years, 10 months ago
- Admin list_display Ajax by whiteinge 7 years, 7 months ago
- "Save and Continue" keyboard command for admin, with autoscroll by jcushman 5 years, 7 months ago
- Radio widget with labels after inputs by avsd 3 years, 1 month ago