Skip to content

Commit

Permalink
Make css_classes argument optional for FormRow
Browse files Browse the repository at this point in the history
  • Loading branch information
johannaengland committed Nov 12, 2024
1 parent b8fec64 commit 48a8044
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/nav/web/crispyforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class FormRow:
:param css_classes: Additional CSS classes to apply to the row. Defaults to an empty string.
"""

def __init__(self, fields: list, css_classes: str = ''):
def __init__(self, fields: list, css_classes: Optional[str] = None):
"""Constructor method"""
self.fields = fields
self.css_classes = css_classes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{# NB! This form row can only render fields that are supported by custom_crispy_templates/_form_field.html #}

<div
class="row {{ field.css_classes|default:'' }}"
class="row{% if field.css_classes %} "{{ field.css_classes }}" {% endif %}"
>
{% block formrow_content %}
{% for field in field.fields %}
Expand Down

0 comments on commit 48a8044

Please sign in to comment.