Drop in dynamic formsets in admin

 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

  1. Complex Formsets, Redux by smagala 4 years, 1 month ago
  2. Complex Formsets by smagala 5 years, 2 months ago
  3. Make hyperlinks for labels of raw_id_fields (jQuery) by ramen 4 years, 3 months ago
  4. Drag and drop ordering of admin list elements using jQuery UI by johj 3 years, 10 months ago
  5. "Save and Continue" keyboard command for admin, with autoscroll by jcushman 4 years, 3 months ago

Comments

(Forgotten your password?)