Is it possible to prepopulate a formset with different data for each row? I\'d like to put some information in hidden fields from a previous view.
According to the d
I had this problem and I made a new widget:
from django.forms.widgets import Select
from django.utils.safestring import mark_safe
class PrepolutatedSelect(Select):
def render(self, name, value, attrs=None, choices=()):
if value is None: value = ''
if value == '':
value = int(name.split('-')[1])+1
final_attrs = self.build_attrs(attrs, name=name)
output = [u'')
return mark_safe(u'\n'.join(output))
Maybe this will work for you too.