Re: Dictionary passed to widget attr gets mutated

2014-10-29 Thread Collin Anderson
You could do this: class FormWithoutBug(forms.Form): attrs = {'type':'time', 'required':'true'} session_start = forms.TimeField(widget=forms.TimeInput(attrs=attrs.copy())) session_end = forms.TimeField(widget=forms.TimeInput(attrs=attrs.copy())) -- You received this message because

Re: Dictionary passed to widget attr gets mutated

2014-10-29 Thread Collin Anderson
Hello, Interesting. Sounds like something that could be documented. Collin -- 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...@googlegroup

Dictionary passed to widget attr gets mutated

2014-10-28 Thread Leon Sasson
When a dictionary is passed to a Widget as the `attr` kwarg, to be used in filling HTML attributes, this dictionary is mutated, so cannot be reused. See below example to see a clear problem with this. Note how in the first form, when printer as_p(), the second field (session_end) gets an incorre