Re: Hidden fields in formsets

2015-03-31 Thread aRkadeFR

Hello,

I read very quickly, but you sure you want to *render* and get the value
of "user_create" from the client?
It can be modified by any client...

aRkadeFR

On 03/31/2015 10:45 AM, François GUÉRIN wrote:

Hi,

I'm using multiple formsets in Create / Update views, and I want to 
set some *hidden* fields in it : user_create, date_create on creation, 
user_update, date_update on update.


I've created a MultiFormsetMixin, which provide machinery to 
initialize those formsets in my CreateView / UpdateView.
Basicaly, the mixin fill a formset_list containing dicts with 
{'formset': , 'name': , 'verbose_name': 
}... The rendering of the formsets uses the same 
rendering than 'normal' formsets, via a {%for formset in formset_list 
%}{# formset rendering #}[% endfor %}. The formsets display normaly.


Data initialization is performed through the 'initial' dict. Every 
forms in the formsets have the same values for those fields, at 
initialization, so I update each form of the formsets with those values.


My problem is that those hidden fields are not rendered in the 
template, even in a 'hidden_field'. I've tryed to set 'exclude' and 
'hidden_fields' Meta option in my ModelForm object, but it doesn't work.


When I go through the 'form.hidden_fields' I have my formset 
administrative normal data (id, parent) but not my fields.


Is it possible to render those fields in the template ?

Thanks !

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/13de9082-3dd5-4b3c-bb72-7393e3f0884c%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/551ACE9D.3050008%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


Hidden fields in formsets

2015-03-31 Thread François GUÉRIN
Hi, 

I'm using multiple formsets in Create / Update views, and I want to set 
some *hidden* fields in it : user_create, date_create on creation, 
user_update, date_update on update.

I've created a MultiFormsetMixin, which provide machinery to initialize 
those formsets in my CreateView / UpdateView. 
Basicaly, the mixin fill a formset_list containing dicts with {'formset': 
, 'name': , 'verbose_name': }... The rendering of the formsets uses the same rendering than 
'normal' formsets, via a {%for formset in formset_list %}{# formset 
rendering #}[% endfor %}. The formsets display normaly.

Data initialization is performed through the 'initial' dict. Every forms in 
the formsets have the same values for those fields, at initialization, so I 
update each form of the formsets with those values.

My problem is that those hidden fields are not rendered in the template, 
even in a 'hidden_field'. I've tryed to set 'exclude' and 'hidden_fields' 
Meta option in my ModelForm object, but it doesn't work.

When I go through the 'form.hidden_fields' I have my formset administrative 
normal data (id, parent) but not my fields.

Is it possible to render those fields in the template ?

Thanks !

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/13de9082-3dd5-4b3c-bb72-7393e3f0884c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.