Skip to content

Commit

Permalink
Uncrispify StyleFormTwo in styleguide
Browse files Browse the repository at this point in the history
  • Loading branch information
johannaengland committed Nov 13, 2024
1 parent 3f0faab commit 9f657f1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
39 changes: 26 additions & 13 deletions python/nav/web/styleguide.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@

from django.shortcuts import render
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms_foundation.layout import Layout, Column, Row, Fieldset

from nav.web.crispyforms import (
FlatFieldset,
FormColumn,
FormRow,
set_flat_form_attributes,
)


class StyleFormOne(forms.Form):
Expand All @@ -36,17 +41,25 @@ class StyleFormTwo(forms.Form):

def __init__(self, *args, **kwargs):
super(StyleFormTwo, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_action = ''
self.helper.form_method = 'POST'
self.helper.layout = Layout(
Fieldset(
'Address form',
Row(
Column('name', css_class='small-6'),
Column('address', css_class='small-6'),
),
)

self.attrs = set_flat_form_attributes(
form_fields=[
FlatFieldset(
legend="Address form",
fields=[
FormRow(
fields=[
FormColumn(
fields=[self["name"]], css_classes="small-6"
),
FormColumn(
fields=[self["address"]], css_classes="small-6"
),
]
)
],
)
]
)


Expand Down
5 changes: 2 additions & 3 deletions python/nav/web/templates/styleguide.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'base.html' %}
{% load crispy_forms_tags %}

{% block base_header_additional_head %}
<style>
Expand Down Expand Up @@ -416,8 +415,8 @@ <h3 class="underline">Forms</h3>
need to create forms - ask on mail/jabber/irc.
</p>

{% crispy form1 %}
{% crispy form2 %}
{% include 'custom_crispy_templates/flat_form.html' with form=form1 %}
{% include 'custom_crispy_templates/flat_form.html' with form=form2 %}

</div>

Expand Down

0 comments on commit 9f657f1

Please sign in to comment.