jrief / django-angular

Let AngularJS play well with Django
http://django-angular.awesto.com/
MIT License
1.23k stars 294 forks source link

Possible bug in RadioChoiceInput #288

Closed rfleschenberg closed 7 years ago

rfleschenberg commented 7 years ago

Hi,

I am not sure if this is a bug in django-angular or somewhere else, but I am seeing a problem where the for attribute of a <label> does not match the id attribute of the associated <input>. The <input> has an additional _0 suffix:

<div validate-multiple-fields="payment_modifier">
<div class="radio"><label for="id_payment_modifier_0"><input id="id_payment_modifier_0_0" name="payment_modifier" ng-change="upload()" ng-model="data.payment_method['payment_modifier']" type="radio" value="pay-in-advance" class="ng-pristine ng-untouched ng-valid"> Pay in advance (bank transfer)</label></div>
</div>

I tracked it down to this: https://github.com/jrief/django-angular/blob/220bf6390e9c83dbb0ad8a3247b9cfb8fda0f6ec/djng/styling/bootstrap3/widgets.py#L81-L82

But I don't know if this code is at fault, or if I am just using django-angular incorrectly. @jrief, can you advise?

adrienbrunet commented 7 years ago

This is a problem with the support of multiple-fields. See #289

jrief commented 7 years ago

This has been fixed in django-angular-1.0 and Django-1.10. It however reappears if used in combination with Django-1.11. I have to investigate why.

jrief commented 7 years ago

By monkey patching RadioChoiceInput this now is also solved in Django-1.11