Closed luigielric closed 7 years ago
If you have a look at the code:
in forms/field_mixins.py
...
if self.required:
self.widget.attrs['ng-required'] = 'true'
...
I guess this is why you don't have your own ng-required. I think we cannot currently set the ng-required. Maybe you want to add this feature? It shouldn't be that complicated. I don't have much time right now but tell me if you need more help.
Cheers
I'm quite new in that area of knowledge but if I can help why not. What do you suggest ? If you have detailed instruction, I would do my best to help ;)
from Django doc:
Field.required¶ By default, each Field class assumes the value is required
You may try to use required=False first in your forms to see if your ng-required is still overwritten.
It works perfectly. Thank you.
Good Evening,
I don't know if i'm doing things properly but i can't manage to set dynamically ng-required to something. In my form, i've got field A, field B and field C. If field A=1 field B is required and C isn't if field A=2 field C is required and C isn't.
My field are created from a model in django.
forms.py
A,B,C are rendered normally like this :
Same for B and C
But it doesn't work. The HTML still looks like this : (the "ng-required" from the widget is not taken into account). Exemple with B :
Is that normal because django-angular is forbidden what I'm trying to do or it's because I'm doing things not properly ?
Thank you for your time !