forked from elo80ka/django-dynamic-formset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added support for the MAX_NUM_FORMS parameter, added to the managem…
…ent form in Django 1.2 - Fixed the autocomplete example - Switched to Google's Closure compiler for minification git-svn-id: https://django-dynamic-formset.googlecode.com/svn/trunk@14 9f2ace40-7153-11de-83e1-4fc93b4a6815
- Loading branch information
stan.madueke
committed
Jul 4, 2010
1 parent
84851a3
commit 1894c1b
Showing
8 changed files
with
205 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block title %}Basic Formset (Table layout){% endblock %} | ||
|
||
{% block extrahead %} | ||
<script type="text/javascript"> | ||
$(function() { | ||
$('#id_contact_info_table tbody tr').formset({ | ||
extraClasses: ['row1', 'row2', 'row3'] | ||
}) | ||
}) | ||
</script> | ||
<!-- Here's an example of how you can style add/delete buttons with CSS --> | ||
<style type="text/css"> | ||
.add-row { | ||
padding-left:18px; | ||
background:url({{ MEDIA_URL }}images/add.png) no-repeat left center; | ||
} | ||
.delete-row { | ||
float:right; | ||
display:block; | ||
margin:5px 0 0 5px; | ||
text-indent:-6000px; | ||
background:url({{ MEDIA_URL }}images/delete.png) no-repeat left center; | ||
width:16px; | ||
height:16px; | ||
} | ||
tr.row1 td { background-color: #f9f9f9; } | ||
tr.row2 td { background-color: #f3f3f3; } | ||
tr.row3 td { background-color: #ededed; } | ||
</style> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div> | ||
<div class="entry"> | ||
<form method="post" action=""> | ||
<table id="id_contact_info_table" border="0" cellpadding="0" cellspacing="5"> | ||
<thead> | ||
<tr> | ||
<th scope="col">Preferred</th> | ||
<th scope="col">Type</th> | ||
<th scope="col">Value</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for form in formset.forms %} | ||
<tr id="{{ form.prefix }}-row"> | ||
<td style="text-align:center;">{{ form.preferred }}</td> | ||
<td>{{ form.type }}</td> | ||
<td>{{ form.value }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
<p> | ||
{{ formset.management_form }} | ||
<input type="submit" value="Submit" /> | ||
</p> | ||
</form> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block sidebar %} | ||
<p> | ||
Django 1.2 added a "MAX_NUM_FORMS" field to the management form; its value maps to the value passed in "max_num" | ||
to the formset factory function. | ||
</p> | ||
<p> | ||
If you're running Django 1.2, you won't be able to have more than 5 forms in this formset. | ||
</p> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.