- Author:
- justhamade
- Posted:
- January 8, 2010
- Language:
- HTML/template
- Version:
- Not specified
- Score:
- 3 (after 3 ratings)
A very plugable way to get Stanislaus jquery dynamic formset working in the admin with adding just one template. Add the following to templates/admin/APP/MODEL/change_form.html and also update the MODEL in the prefix setting.
Thanks Stanislaus
http://elo80ka.wordpress.com/2009/10/10/jquery-plugin-django-dynamic-formset/
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | {% extends "admin/change_form.html" %}
{% load i18n admin_modify adminmedia %}
{% block extrahead %}
{{ block.super }}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript">
  // Define this so we don't have to bother with the admin jsi18n stuff:
  function gettext(msgid) { return msgid; }
  $(function() {
      $('.inline-related tbody tr').formset({
      prefix: 'MODEL_set',
      addText: 'Add',
      deleteText: 'Delete',
  });
});
</script>
<style type="text/css">
  .add-row {
      padding-left:18px;
      background:url({% admin_media_prefix %}img/admin/icon_addlink.gif) no-repeat left center;
  }
  .delete-row {
      float:right;
      display:block;
      padding-left:18px;
      background:url({% admin_media_prefix %}img/admin/icon_deletelink.gif) no-repeat left center;
  }
<style>{% endblock %}
 | 
More like this
- Bootstrap Accordian by Netplay4 6 years, 9 months ago
- Bootstrap theme for django-endless-pagination? by se210 9 years, 9 months ago
- Bootstrap theme for django-endless-pagination? by se210 9 years, 9 months ago
- Reusable form template with generic view by roldandvg 9 years, 10 months ago
- Pagination Django with Boostrap by guilegarcia 10 years ago
Comments
Please login first before commenting.