elo80ka / django-dynamic-formset Goto Github PK
View Code? Open in Web Editor NEWA jQuery plugin that allows you dynamically add new forms to a rendered django formset.
A jQuery plugin that allows you dynamically add new forms to a rendered django formset.
From [email protected] on December 27, 2010 08:15:02
What steps will reproduce the problem? 1. Installed current trunk of django-dynamic-formset jQuery plugin
2. Leverage inline formset demo to get working form - add/remove/etc within Internet Explorer
I would be happy to supply additional information.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=20
From [email protected] on November 15, 2011 21:31:41
Using the tagName approach does not work in Google Chrome with the jQuery 1.6.x. is() is generally more reliable and the patch is really small and should not introduce any regressions.
Attachment: django-dynamic-formset.patch
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=40
From [email protected] on August 14, 2011 20:01:34
This file didn't get updated when the 1.2 package was released, NBD.
Attachment: INSTALL.txt.patch
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=33
From [email protected] on September 19, 2012 05:01:02
I am doing nested formsets, which makes everything quite subtle and complicated (at least it seems that way to me). I'll try to make sense, apologies if I don't :-)
The explicit problem that I have is around deletion of rows from the outermost formset leaving .prefix wrong on subsequent instances of the inner formset.
Assume the following initial structure:
outer-formset-0
inner-formset-0-empty-form
outer-formset-1
inner-formset-1-empty-form
outer-formset-empty-form
I have only slightly hair raising code to call formset on the outer formset (with prefix=="outer-formset") and inner formsets (with prefix "inner-formset-0" and then "inner-formset-1").
Then: delete outer-formset-0, add a formset to the remaining outer-formset and submit the form. The data from the added formset will not end up in the right place.
What's happened? Well, when outer-formset-0 got deleted, the 'id's and 'name's of the input elements of inner-formset-1-empty-form got munged (s/inner-formset-1/inner-formset-0) -- but the .prefix in the options object of the formset is still "inner-formset-1"! So when you clone the empty form adding a new row, the input elements do not have the 'id' and 'name' munged. Hence the problem.
Now, if there was some magical way of making this work that would be create. But I can't see it, so I've worked around it by hacking my copy of jquery.formset.js to do this:
$$.data('options', options);
And then in the 'removed' callback, I iterate through all the inner formsets and make sure prefix is set correctly. What version of the product are you using? On what operating system? r20 from svn. Please provide any additional information below. Thanks for reading this far!
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=48
From [email protected] on April 19, 2011 04:09:10
What steps will reproduce the problem? 1. Create a ModelForm add two or more InlineFormsets
2. In page add more than one of each inlineformset
3. Submit form What is the expected output? What do you see instead? Expected output: form + multiple formsets would be added to the database
Result: Only the first of each additional inlineformset is added to the db What version of the product are you using? On what operating system? 1.2 Please provide any additional information below. I can get all the inlineformset data into the db if and only if I add all the inlineformsets plus an additional one, then delete the additional inlineformset this is the only work around.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=27
From [email protected] on September 26, 2011 17:42:41
What steps will reproduce the problem? 1. Create an inline formset with 'extra' and hide the extra with jQuery
2. Choose a row of extra as formTemplate
3. Click 'add' in browser What is the expected output? What do you see instead? Instead of one, there are several delete links per new row What version of the product are you using? On what operating system? Trunk. Debian Squeeze Please provide any additional information below. Commenting out line 135:
insertDeleteLink(template);
fixed it for me, but you'd probably like to put it in a conditional clause
Advantages of choosing (and hiding) 'extra' as formTemplate:
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=35
From [email protected] on March 29, 2011 20:34:41
Not sure why the additional "|(^)" was on this regexp. It was causing my attributes to result in "[prefix]-[current int]-[attr]_[prefix]-[previous integer]-[attr]"
Removing the ending regex fixed it for me.
Attachment: jquery.formset.js.patch
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=26
From vruiz2.0 on August 03, 2010 21:17:21
When you render a form directly in a template, the plugin doesn't remove the element for delete. For example:
{% for form in formset %}
{{ form }}{% endfor %}
This way adds a element for delete element. It can be solved adding a simple line near line 90:
$$.each(function(i) {
var row = $(this),
del = row.find('input:checkbox[id $= "-DELETE"]');
if (del.length) {
// If you specify "can_delete = True" when creating an inline formset,
// Django adds a checkbox to each form in the formset.
// Replace the default checkbox with a hidden field:
del.before('<input type="hidden" name="' + del.attr('name') +'" id="' + del.attr('id') +'" />');
del.remove();
}
row.find('label[for $= "-DELETE"]').parent().remove();
if (hasChildElements(row)) {
insertDeleteLink(row);
row.addClass(options.formCssClass);
applyExtraClasses(row, i);
}
});
It's a possible solution, but it isn't the best :)
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=12
From [email protected] on September 03, 2010 21:41:42
it seems to me that the regex (new RegExp('(' + prefix + '-\d+-)|(^)')) doesn't work because the OR part (|(^)) always match, so where you do something as
"id_form-2-name".replace(regex, "form-3-name"), the regex will match (^) and the result will be "form-3-nameid_form2-name".
changing the regex to RegExp('(' + prefix + '-\d+-)|(^ *$)') solves the problem. I don't know if this is the desired behavior, but it works for me like this.
thanks
bruno
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=16
From [email protected] on June 29, 2010 20:59:44
The "add another" link doesn't respect MAX_NUM_FORMS.
I might have over looked something but the dynamic adding doesn't seem to support the max_num property of the formset as represented by MAX_NUM_FORMS. I didn't find a setting to make this work. I might be able hack enough with the add and remove hooks to make this work but an internal solution seems more natural.
If this should be dealt with inside the main code base I should be able to provide a patch tomorrow. If I have just missed something please let me know.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=10
From [email protected] on June 18, 2010 00:37:53
What steps will reproduce the problem? 1. Use any of the demo applications.
2. View the input element ids using Firebug or equivalent. What is the expected output? What do you see instead? I would expect ids that look like "id_form-0-value", but instead I see "form-1-id_form-0-value". What version of the product are you using? On what operating system? Latest SVN, Firefox on Ubuntu. Please provide any additional information below. The problem is this regex:
var idRegex = new RegExp('(' + prefix + '-\d+-)|(^)')
This always matches the start of the string unless the prefix happens to be right at the start (like it is with the name attribute). I'm not sure what the purpose of the second group in the regex is. If it is to deal with empty attributes, this will work better:
var idRegex = new RegExp('(' + prefix + '-\d+-)|(^$)')
Thanks,
Forest
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=9
From [email protected] on September 27, 2012 22:40:11
Hi, sorry my english. I need lock the crations of new rows if a field value is ''. For use it:
$('#form').formset({
...
lockEmptyPattern: 'input[type="text"]'
});
This, check if the inputs fields have content, if don't have nothing, you can't create a new row, and the empty field is focused.
Other example, with customize action:
$('#form').formset({
...
lockEmptyPattern: '*[required]',
lockEmptyCallback: function (element) {
alert("Field " + element.get(0).tagName + " is required");
}
});
I attach a patch file.
Attachment: jquery.formset.js-lockEmptyPattern.patch
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=49
From [email protected] on July 18, 2010 00:20:35
Having a formset with a textarea, and having this textarea a value, when a new row is inserted, it'll copy the textarea value.
It's simple to solve:
if (elem.is('input:checkbox') || elem.is('input:radio')) {
elem.attr('checked', false);
}
else if (elem.is('textarea')) {
elem.html('');
}
else {
elem.val('');
}
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=11
From [email protected] on April 05, 2010 15:19:46
What steps will reproduce the problem? 1. Have at least 2 formsets on one page that initially have 1 form in each.
2. Initialize the formsets as per the django-dynamic-formset documentation.
3. Click on the 'add another' link. What is the expected output? What do you see instead? The 'remove' link will ONLY be added to the forms in the formset where the
'add another' link is located. What version of the product are you using? On what operating system? 1.1, tested in safari + firefox Please provide any additional information below. My fix:
change line 93 of jquery.formset.js from:
if (formCount > 1) { $('a.' + options.deleteCssClass).show(); }
to:
if (formCount > 1) { $('.' + options.formCssClass + ' a.' +
options.deleteCssClass).show(); }
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=8
From [email protected] on December 26, 2011 08:05:51
What steps will reproduce the problem? 1. Create inlineformset_factory with max_num set
2. Go to page showing form
3. Add unlimited number of forms, limit not respect What is the expected output? What do you see instead? Number of forms on page should be limited by max_num. Instead it is ignored. What version of the product are you using? On what operating system? 1.3 Please provide any additional information below. I noticed that max_num isn't being respected. I found the issue to be:
maxForms = $('#id_' + options.prefix + '-MAX_NUM_FORMS'),
options.prefix does not work as intended. In my case it should be "result_set" so (id="id_result_set-MAX_NUM_FORMS"). Using the debugger in Safari I discovered that options.prefix was not correct, it was empty (leading to "id_MAX_NUM_FORMS").
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=41
From [email protected] on August 24, 2012 10:26:53
I'm using version 1.2 of django-dynamic-formset. I really like it but I would like to suggest a change.
I've noticed when you add a new form it keeps the old dropdown values.
So I've changed my local copy to allow for this and I'm just sharing the changes I've made (see attached diff) incase you would like to add this patch.
Attachment: select_reset.diff
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=47
From [email protected] on September 14, 2010 15:20:52
http://code.google.com/p/django-ajax-selects Using both together would be great. Sadly they do no seem to work together. I see two problems when using both
If I can come up with a fix I'll post it. Using both would make for some really nice formsets!
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=17
From [email protected] on June 03, 2012 17:22:10
What steps will reproduce the problem? 1. View:
@login_required
def newactors(request,matrixID):
mID = int(matrixID)
matrix = get_object_or_404(ThreatMatrix,pk=mID)
if not matrix.user_is_authorized(request.user):
raise Http404
else:
if request.method == 'POST':
actorformset = ActorFormSet(request.POST, instance=matrix)
if actorformset.is_valid():
debug ("Formset is valid")
raise EBADBREAK # abort before save to inspect things
savedactors = actorformset.save()
# because we want to override threatMatrix if the user has changed it...
return HttpResponseRedirect('/newactors/%d' % mID)
else:
return render(request,'newactors.html',{'actorformset':actorformset})
else:
a = ActorFormSet(instance=matrix)
return render(request,'newactors.html',{'actorformset':a})
class ActorForm(forms.ModelForm):
class Meta:
model=Actor
widgets = {
'name': forms.TextInput(attrs={'size': 40,}),
'desc': forms.TextInput(attrs={'size': 80,}),
}
ActorFormSet = inlineformset_factory(ThreatMatrix,Actor,form=ActorForm, can_delete=True, extra=0)
{% extends "basetemplate.html" %}
{% load i18n %}
{% block head %}
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src='/static/jquery.formset.min.js' type='text/javascript'></script>
<script type="text/javascript">
$(function() {
$('.actorform').formset({
prefix: '{{ formset.prefix }}'
});
})
</script>
{% endblock %}
{% block main %}
{% endblock %}
actor_set-6-name u'f'
actor_set-6-desc u'b'
actor_set-TOTAL_FORMS u'6'
Actual output is
actor_set-NaN-name u'f'
actor_set-NaN-desc u'b'
actor_set-TOTAL_FORMS u'5' What version of the product are you using? On what operating system? Trunk on Mac OSX 10.7.3 Please provide any additional information below.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=45
From [email protected] on January 19, 2011 13:51:07
Using Internet Explorer 8, when I have a formset with tables, and I try to delete the first row of the table, an error appears, and closes the browser.
I do not know if this is a problem in the browser, or some other javascript that is closing the browser. I'm using on the same page the Jquery UI and Fancybox scripts
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=22
From [email protected] on June 05, 2011 14:50:24
What steps will reproduce the problem? example:
extra=1
[...]
<script> $(function() { $('#formsetB .formB').formset({ prefix: '{{ formsetB.prefix }}', formTemplate: '#empty-formB', }); }) </script>[...]
{% with formsetB.empty_form as form %}
{% endwith %}
[...]
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=29
From [email protected] on October 10, 2011 09:46:43
What steps will reproduce the problem? 1. set the addText to something with a button, like this: "
"} else if (elem.is('input:button')) { ; // Do nothing;
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=37
From [email protected] on May 11, 2011 08:05:14
What steps will reproduce the problem? add a row to a formset. "id" and "for" Elements attributes are not generated correctly. "Id" and "For" contains "id_" prefix thats mismatch the replacement regular expression.
I use this one : var idRegex = new RegExp('(.)' + prefix + '-\d+-(.)'),
replacement = '$1' + prefix + '-' + ndx + '-$2'; What is the expected output? What do you see instead? What version of the product are you using? On what operating system? jQuery Formset 1.2
Django 1.3
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=28
From [email protected] on September 29, 2011 22:32:24
What steps will reproduce the problem? 1. Ensure ajax_select module is not installed
2. cd demo/
3. python manage.py syncdb What is the expected output? What do you see instead? I get "ImportError: No module named ajax_select" What version of the product are you using? On what operating system? SVN r17 of django-dynamic-formset
$ python manage.py --version
1.2.5
Running on Ubuntu 11.04. Please provide any additional information below. I did not see this dependency mentioned in any of the django-dynamic-formset files or on the project website, so it should be added somewhere. I fixed the issue on Ubuntu with the following:
$ apt-get install django-ajax-selects
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=36
From [email protected] on June 04, 2012 22:35:18
Currently, the formset module removes rows before calling the row.removed function. The problem with this behavior is that when a developer is working with multiple formsets on a single page, they cannot select the proper one based on the parent of the removed row. This patch will simply pass through the immediate parent of the removed row to the removed function, so that selecting based off the parent is possible. If there is some way that I am not aware of to do this without passing through the parent, please let me know, I am curious. Thanks.
Attachment: jquery.formset.js.patch
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=46
From m%[email protected] on December 09, 2010 19:52:27
In order to be able to edit empty formsets, I need to pass "extra=1" (which is default) parameter in the formset_factory function, or else the jQuery plugin is unable to clone forms.
But if the formset is not empty, I actually don't need any extra lines to be added. Unfortunately, django's formset_factory function doesn't understand "min_num" parameter (though it does understand "max_num"), and hence I always get an extra line in formsets which I almost always need to remove manyally, otherwise a formset can't be validated due to empty required fields in the extra line.
Is there any workaround for this situation? I looked through the docs but failed to find anything about the issue.
Thanks.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=18
From [email protected] on October 20, 2011 23:22:52
What steps will reproduce the problem? 1. Add some additional elements (for instance, additional buttons) inside last column of table formset.
2. Even though I placed hidden input (delete control) before all other elements, visible Delete button rendered after all other elements in a cell. What is the expected output? What do you see instead? Delete button rendered in place of hidden input (delete control). Please provide any additional information below. Here is a simple path.
Instead this:
row.children(':last').append('' + options.deleteText + '');
Use this:
row.find('input:hidden[id $= "-DELETE"]').after('' + options.deleteText + '');
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=39
From [email protected] on August 23, 2011 21:32:45
What steps will reproduce the problem? 1. Run 'pip install -E svn+ http://django-dynamic-formset.googlecode.com/svn/trunk' What is the expected output? What do you see instead? Expected: Package is installed.
Actual: Error because setup.py does not exist. What version of the product are you using? On what operating system? r17 , mac os x Please provide any additional information below. We should add a setup.py file so that django-dynamic-formset can be installed automatically using a pip/virtualenv solution.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=34
From brianna.laugher on August 11, 2010 05:21:41
Hi,
This is pretty kick-ass, thanks for making it available.
I am also using django-uni-form which makes it easy to render forms in divs. There is only a small change needed to jquery.formset.js to make them work well together.
change line
$(row).find('input,select,textarea,label').each(function() {
to
$(row).find('input,select,textarea,label,div').each(function() {
then in my template, my javascript function is:
<script type="text/javascript">
$(function() {
$('#feedbackForms .singleForm').formset();
})
</script>
then later in my template, my layout is thus:
Then it all works perfectly. Just thought I would add this in case anyone else is using them together.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=13
From [email protected] on January 22, 2010 22:09:23
I have added a couple things to the plugin that I thought I should share.
Patch is attached.
Attachment: jquery.formset.js.patch
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=5
From [email protected] on January 18, 2012 17:39:20
Immagine a nested model:
grandparent > parent > son
If you have a page with 1 "parent" and the "son" formset relative to that "parent" everything is fine.
I wanted to have a page with all the "parents" related to a specific "grandparent" divided by tabs and for each of that "parent" (in each tab) I wanted to have the "son" formset.
In this case if I add a new son with the add button and then I remove it and save I get a "MultiValueDictKeyError" from django. This happens because some input names attributes are not renamed correctly.
I couldn't fix the regular expression (and I don't know if it behaves strangely because something I did wrong) so I found a workaround.
Because each parent is contained in a tab which has a specific class I tweaked the code so that in these cases you can specify the class of the container of each "parent" so that when input names are renamed the script renames only the inputs of the "parent" actually editing and not all the other ones.
It's quite difficult to explain.. I attach the patch, the changes are anticipated by comments containing "EDIT BY NEMESIS"
If you want to see how I'm using it contact me privately (i leave my email in the first 2 lines of the script) and I'll give you access to the application in which i'm using the patched script. What is the expected output? What do you see instead? What version of the product are you using? On what operating system? Please provide any additional information below.
Attachment: jquery.formset.js
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=42
From [email protected] on February 08, 2011 18:17:32
What steps will reproduce the problem? 1.Create a new instance using a form with an inline formset and this jquery plugin
2.Save the form after adding several items to the formset. Have the extra flag set to at least one
3.Edit the form and click the remove link next to a formset item that was already created in the previous step
4. Save the form
What is the expected output?
The form should save and the item that you removed should be removed
What do you see instead?
If the model class field is set to required for the formset, the formset will fail validation. If the field is set to null=True and blank=True the save will insert an empty record What version of the product are you using? On what operating system? 1.2 of the plugin and 1.2.3 of DJango Please provide any additional information below. If you create a new form and have extra set to 1 or any other number, the formset is not creating a blank item or failing validation for all of the empty rows. It seems to only happen when you edit an existing form. The only way to pass validation is to remove all the empty rows.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=24
From [email protected] on January 13, 2011 12:06:33
What steps will reproduce the problem? 1. Go to the inline-formset-autocomplete example and hit "submit". it crashes.
What do you see instead?
Environment:
Request Method: POST
Request URL: http://localhost:8000/examples/inline-formset-autocomplete/
Django Version: 1.2.3
Python Version: 2.6.6
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'example']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response
response = callback(request, _callback_args, *_callback_kwargs)
formset = OrderedItemFormset(request.POST, instance=order)
queryset=qs)
super(BaseModelFormSet, self).**init**(**defaults)
self._construct_forms()
self.forms.append(self._construct_form(i))
form = super(BaseInlineFormSet, self)._construct_form(i, **kwargs)
pk = self.data[pk_key]
raise MultiValueDictKeyError("Key %r not found in %r" % (key, self))
Exception Type: MultiValueDictKeyError at /examples/inline-formset-autocomplete/
Exception Value: "Key 'ordered_items-0-id' not found in <QueryDict: {u'ordered_items-0-quantity': [u'5'], u'ordered_items-2-quantity': [u'1'], u'ordered_items-3-product': [u'3'], u'ordered_items-5-quantity': [u''], u'ordered_items-3-quantity': [u'3'], u'ordered_items-1-order': [u'1'], u'ordered_items-4-product': [u'3'], u'ordered_items-0-product': [u'1'], u'ordered_items-2-product': [u'7'], u'ordered_items-5-product': [u''], u'ordered_items-1-quantity': [u'1'], u'ordered_items-INITIAL_FORMS': [u'5'], u'ordered_items-2-order': [u'1'], u'ordered_items-0-order': [u'1'], u'ordered_items-4-order': [u'1'], u'ordered_items-TOTAL_FORMS': [u'6'], u'ordered_items-4-quantity': [u'5'], u'customer': [u'Kermit the frog'], u'ordered_items-1-product': [u'3'], u'ordered_items-MAX_NUM_FORMS': [u''], u'ordered_items-5-order': [u'1'], u'ordered_items-3-order': [u'1']}>" What version of the product are you using? On what operating system? 1.2 Firefox GNU/Linux Please provide any additional information below. the template "inline-formset-autocomplete.html" is missing the following two lines which are in inline-formset.html. If you add them it doesn't crash:
{% for fld in form.hidden_fields %}{{ fld }}{% endfor %}
{% if form.instance.pk %}{{ form.DELETE }}{% endif %}
thanks for all your work on django-dynamic-formset, it's really neat!
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=21
From [email protected] on February 20, 2010 19:55:37
My template include some more complex add/delete formset links already
inside formset so there is no need to add them to the end. A simple CSS
class added to the anchor tag is not enough for my use.
The attached patch adds an option called autoAddLinks that you can set to
false to prevent any links being added.
Attachment: jquery.formset-add_option_to_not_auto_add_adddel_links.patch
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=6
From [email protected] on July 06, 2011 19:53:10
What steps will reproduce the problem? 1. Create a form which contains two different formsets
2. Click the add button of the first formset
3. The new form row is added to the second formset
4. Click the add button from the second formset and it will add a new row .. but using the first formset as template
I've provided a patch for this, however it changes slightly the usage because it requires the formsets to be wrapped into a block element that has a formset
class (the element type doesn't matter).
Ex:
{# formset 1 goes here #}Attachment: formset.patch
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=32
From [email protected] on June 21, 2011 05:42:54
Added beforeRemove callback that can cancel row deletion (e.g. in case of confirmation)
Attachment: jquery.formset.js.patch
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=31
From [email protected] on February 02, 2011 14:14:18
What steps will reproduce the problem? 1. Add few formsets in a page, for instance
{{ formset1.management_form }}
{% for form in formset1.forms %}
{{ formset2.management_form }}
{% for form in formset2.forms %}
Little patch for fix this bug.
Attachment: delete.patch
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=23
From nick.bolton.uk on November 22, 2009 18:30:01
What steps will reproduce the problem? 1. Create an instance of a formset with an instance.
2. Remove the first row.
3. Add a row to the end. What is the expected output? What do you see instead? I expect this to behave just as it would when the first row is not removed. What version of the product are you using? On what operating system? # Django
VERSION = (1, 1, 0, 'final', 0) Please provide any additional information below. Exception Type: ValueError
Exception Value: invalid literal for int() with base 10: ''
Exception Location: C:\Python25\lib\site-
packages\django\db\models\fields__init__.py in get_db_prep_value, line 361
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=3
From brianna.laugher on August 17, 2010 06:34:13
I have a form that has input type=text, input type=radio and select elements. The input type=text and the input type=radio have default text/selections.
When I add a new form, the new form has no text or selections (as expected), but it also removes the radio selection in the initial form.
It doesn't alter the select or the input type=text fields.
I am using a prefix. I'm also using Jquery v1.4.2. I will attach a file that demonstrates the problem.
Attachment: test.html
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=14
From m%[email protected] on December 10, 2010 13:31:32
I'd like to be able to set "minForms" parameter which would disallow deleting forms from formset if their count is less or equal to "minForms". For example, I need at least one form to be present.
Is that possible in the current version?
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=19
From [email protected] on October 14, 2011 23:54:53
What steps will reproduce the problem? 1. Create formset using table. Use jQuery 1.6.x
2. IE 8 will render overlapped "Add another" link. This is because there is no TR>TD container provided for a link. What is the expected output? What do you see instead? "Add another" link should be placed inside TR>TD. What version of the product are you using? On what operating system? jQuery 1.6.4 Please provide any additional information below. This issue caused by change in jQuery 1.6 http://bugs.jquery.com/ticket/9228 Fix is pretty easy, use:
if (
istead
if ($$.attr('tagName') == 'TR')
attr('tagName') is left for compatibility with older jQuery, where no prop method ( http://api.jquery.com/prop ) available.
Attachment: jquery.formset.js
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=38
From [email protected] on September 03, 2010 21:05:19
I have a formset of forms that contains some hidden fields with inital data and i'd like those initial data to be copied when I add a new form using the plugin.
I'm attaching a patch to solve this by not removing the val() on hidden fields, but I think maybe there should be an option for this.
thanks for the plugin, it's really useful :)
bruno gola
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=15
From [email protected] on May 14, 2012 13:22:56
What steps will reproduce the problem? 1. Set deleteCssClass to have multiple values (e.g. "btn btn-danger") What is the expected output? What do you see instead? Remove link should have click handler event bound properly. Instead, no matches are found and nothing happens when the delete link is clicked. What version of the product are you using? On what operating system? 1.2 - Mac OS X 10.7.3 Please provide any additional information below.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=44
From [email protected] on October 31, 2012 01:47:18
Fix for issue #44 : Multiple deleteCssClass values causes jQuery to not match query
Attachment: jquery.formset.js.patch
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=50
From carl.j.meyer on February 26, 2011 23:55:17
This makes it confusing to figure out which code version you are actually using.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=25
From [email protected] on March 30, 2010 14:58:24
What steps will reproduce the problem? 1. Start demo
2. Go to http://localhost:8000/
3. Check source: refers to /static/js/jquery.formset.js What is the expected output? What do you see instead? - expected: script file is found
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=7
From nick.bolton.uk on November 22, 2009 18:32:27
There doesn't seem to be a mailing list, so I figured this is the best place
to post my issue.
I noticed that removing a dynamic row will not remove the row in the db, and
the only way to do this is to check the Delete checkbox and save.
Is there a way of setting a row's delete value to "true" and then hiding the
row, instead of removing it?
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=4
From [email protected] on October 21, 2009 19:31:51
What steps will reproduce the problem? 1. In Django, create a form with a field:
mycheckbox = forms.booleanField(required=False)
2. Set jquery.formset.js to do it's thing on said form
3. Render the page in a browser, click 'add' to generate another form on
the page
4. Check the checkbox element on the newly added form
5. Submit the form, validate it through Django
6. Look at form.cleaned_data['mycheckbox'] - it is False, despite the
checkbox being checked What is the expected output? What do you see instead? On a POST or GET submission of a form, input elements of type="checkbox"
will either not get sent in headers/params or will get sent containing
their value attribute (default value is 'on' if it is not set).
Currently, when a new form is generated, $(this).val('') gets called on all
copied elements, which sets their value attributes to ''. When this happens
in a checkbox input element, it alters the behavior of the checkbox
element, making an empty string get sent as the value if it is checked.
When Django processes the checkbox field, the
form.cleaned_data['mycheckbox'] will always return False on the checked
input element of a generated/added form. What version of the product are you using? On what operating system? v1.0 Please provide any additional information below. I've attached a patch. I'm very new to jQuery so this is probably not the
most elegant fix but the intent should be clear.
Thanks for the awesome plugin!
Attachment: dynamic-forms-checkbox-fix.patch
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=1
From [email protected] on March 29, 2012 17:35:21
In DJANGO 1.4 .. it wont work.
Update TEMPLATE_LOADERS section to this.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
Check this documentation. https://docs.djangoproject.com/en/1.4/internals/deprecation/ load_template_source is deprecated.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=43
From [email protected] on November 16, 2009 04:32:07
If your formset has a select field with a set of values clearing this will
cause issues.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=2
From [email protected] on June 16, 2011 01:55:18
What steps will reproduce the problem? 1. Create 2 model formsets:
ParentFormSet = modelformset_factory(Parent, extra=1, can_delete=True, max_num=2)
GuardianFormSet = modelformset_factory(Guardian, extra=1, can_delete=True, max_num=10)
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/iep_admin/add_student/5/
Django Version: 1.3
Python Version: 2.7.1
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.flatpages',
'django.contrib.staticfiles',
'django.contrib.webdesign',
'grappelli',
'django.contrib.admin',
'django.contrib.admindocs',
'uni_form',
'pagination',
'south',
'django_coverage',
'smart_selects',
'ajax_filtered_fields',
'ckeditor',
'countries',
'accounts',
'about',
'addresses',
'phones',
'languages',
'races',
'schools',
'persons',
'parents',
'guardians',
'students',
'employee',
'reports',
'iepachieve_app',
'note',
'transitions',
'dajaxice',
'iep_admin',
'iep_panel',
'task',
'meeting']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'pagination.middleware.PaginationMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')
Traceback:
File "/home/ki/Envs/iepachieve/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
response = callback(request, _callback_args, *_callback_kwargs)
guardian_formset = GuardianFormSet(request.POST, request.FILES, queryset=guardian_queryset, prefix='guardian')
super(BaseModelFormSet, self).**init**(**defaults)
self._construct_forms()
self.forms.append(self._construct_form(i))
pk = self.data[pk_key]
raise MultiValueDictKeyError("Key %r not found in %r" % (key, self))
Exception Type: MultiValueDictKeyError at /iep_admin/add_student/5/
Exception Value: "Key 'guardian-0-id' not found in <QueryDict: {u'last_name': [u'Belvedersky'], u'classification': [u'ED'], u'grade': [u'2'], u'guardian-1-middle_name': [u''], u'parent-0-race': [u''], u'guardian-1-birth_date': [u'1983-07-06'], u'phone_numbers': [u'1152'], u'guardian-TOTAL_FORMS': [u'2'], u'first_name': [u'Appolon2'], u'parent-0-first_name': [u'Ki4'], u'middle_name': [u''], u'parent-0-language': [u''], u'guardian-INITIAL_FORMS': [u'1'], u'parent-0-last_name': [u'P'], u'csrfmiddlewaretoken': [u'b66057413251cd8b465fb72a6c87ce5a'], u'parent-0-id': [u'11'], u'parent-0-DELETE': [u''], u'parent-INITIAL_FORMS': [u'1'], u'parent-0-gender': [u'm'], u'parent-0-occupation': [u''], u'parent-MAX_NUM_FORMS': [u'2'], u'parent-0-middle_name': [u''], u'parent-0-birth_date': [u'1983-07-06'], u'guardian-1-occupation': [u''], u'guardian-1-last_name': [u'Last'], u'guardian-1-id': [u'17'], u'guardian-1-first_name': [u'Guadian7'], u'guardian-1-race': [u''], u'language': [u''], u'level': [u'2'], u'gender': [u'm'], u'guardian-1-gender': [u'm'], u'race': [u''], u'guardian-1-DELETE': [u'on'], u'parent-TOTAL_FORMS': [u'1'], u'birth_date': [u'2010-11-17'], u'guardian-1-language': [u''], u'guardian-MAX_NUM_FORMS': [u'10']}>"
**************** What version of the product are you using? On what operating system? Please provide any additional information below.
Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=30
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.