Skip to content

Commit

Permalink
Merge pull request #3187 from Uninett/refactor/form-row-optional-css-…
Browse files Browse the repository at this point in the history
…classes

Make `css_classes` argument optional for `FormRow`
  • Loading branch information
johannaengland authored Nov 13, 2024
2 parents 8b8bd55 + fc81e8a commit f8e82bf
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 @@ -96,7 +96,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 f8e82bf

Please sign in to comment.