Fix for required-fields tag
This commit is contained in:
parent
74dc779999
commit
a26f9a6f18
1 changed files with 4 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
from django import template
|
||||
from django.forms import Form
|
||||
|
||||
|
||||
register = template.Library()
|
||||
|
@ -7,6 +8,9 @@ register = template.Library()
|
|||
@register.filter
|
||||
def has_required_fields(form):
|
||||
for field in form:
|
||||
if isinstance(field, Form):
|
||||
if has_required_fields(field):
|
||||
return True
|
||||
if field.field.required:
|
||||
return True
|
||||
return False
|
||||
|
|
Loading…
Reference in a new issue