Skip to content
Snippets Groups Projects
Commit aeadd134 authored by Julian's avatar Julian
Browse files

Rename splitted to split

parent 99cce0d5
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@ from django import forms
from django_split_input import SplitInput
class SplittedInputForm(forms.Form):
splitted_input_1 = forms.CharField(label='3 3-wide text inputs', widget=SplitInput(sizes=(3, 3, 3)))
splitted_input_2 = forms.CharField(label='4 different sized password inputs',
widget=SplitInput(sizes=(1, 2, 3, 4), input_widget=forms.PasswordInput))
class SplitInputForm(forms.Form):
split_input_1 = forms.CharField(label='3 3-wide text inputs', widget=SplitInput(sizes=(3, 3, 3)))
split_input_2 = forms.CharField(label='4 different sized password inputs',
widget=SplitInput(sizes=(1, 2, 3, 4), input_widget=forms.PasswordInput))
......@@ -4,12 +4,12 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Splitted Input Form</title>
<title>Split Input Form</title>
<script type="text/javascript" src="{% static "jquery/dist/jquery.min.js" %}"></script>
<script>
window.clear_splitted_inputs = {% firstof clear "true" %};
window.clear_split_inputs = {% firstof clear "true" %};
</script>
{{ splitted_form.media }}
{{ split_form.media }}
<style>
body {
width: 80%;
......@@ -25,12 +25,12 @@
</style>
</head>
<body>
<h1>Splitted Text Inputs</h1>
<h1>Split Text Inputs</h1>
<h2>Forms</h2>
<form method="post">
{% csrf_token %}
<table>
{{ splitted_form.as_table }}
{{ split_form.as_table }}
</table>
<input type="submit" value="Submit"/>
</form>
......@@ -51,7 +51,7 @@
<th>form.cleaned_data key</th>
<th>form.cleaned_data value</th>
</tr>
{% for key, value in splitted_form.cleaned_data.items %}
{% for key, value in split_form.cleaned_data.items %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
......
from django.shortcuts import render
from .forms import SplittedInputForm
from .forms import SplitInputForm
def form(request):
if request.method == 'POST':
context = {
"splitted_form": SplittedInputForm(request.POST),
"split_form": SplitInputForm(request.POST),
"clear": True,
}
else:
context = {
"splitted_form": SplittedInputForm(),
"split_form": SplitInputForm(),
}
return render(request, 'form.html', context)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment