Skip to content

Commit b94656f

Browse files
committed
add_tailwindcss, crispy_forms
1 parent a10343b commit b94656f

4 files changed

Lines changed: 27 additions & 13 deletions

File tree

backendapi/forms.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33

44

55
class RegistrationForm(forms.Form):
6-
name = forms.CharField(label="Enter your name", max_length=100, required=True)
7-
surname = forms.CharField(label="Surname", max_length=100, required=True)
8-
discord = forms.CharField(label="Discord", max_length=100, required=True)
9-
phone = forms.CharField(label="Phone", max_length=100, required=True)
6+
first_name = forms.CharField(label="Enter your name", max_length=100, required=True)
7+
last_name = forms.CharField(label="Last Name", max_length=100, required=True)
8+
email = forms.CharField(label="Discord", max_length=100, required=True)
9+
phone_number = forms.CharField(label="Phone", max_length=100, required=True)
1010
crew = forms.CharField(label="Crew", max_length=100, required=True)
11-

config/settings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"tailwind",
5050
"theme",
5151
"django_browser_reload",
52-
52+
"crispy_forms",
53+
"crispy_tailwind",
5354
]
5455

5556
MIDDLEWARE = [
@@ -151,3 +152,6 @@
151152

152153
NPM_BIN_PATH = os.getenv("NPM_BIN_PATH")
153154

155+
CRISPY_ALLOWED_TEMPLATE_PACKS = "tailwind"
156+
157+
CRISPY_TEMPLATE_PACK = "tailwind"

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ psycopg2-binary==2.9.10
55
djangorestframework==3.15.2
66
django-tailwind>=3.6.0
77
django-browser-reload==1.13.0
8+
crispy-tailwind==0.5.0
89

910

theme/templates/registration.html

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
{% extends "base.html" %}
2+
{% load tailwind_filters %}
23

34

45
{% block title %}registration{% endblock %}
56

67
{% block content %}
7-
<h1> foo</h1>
8-
<form method="POST">
9-
{% csrf_token %}
10-
{{ form }}
11-
<Button> Click</Button>
12-
asdasd
13-
</form>
8+
<div class="max-w-md mx-auto bg-white shadow-lg rounded-lg p-8 mt-10">
9+
<h1 class="text-2xl font-semibold text-gray-800 mb-6">Registration Form</h1>
10+
11+
<form method="POST" class="space-y-6">
12+
{% csrf_token %}
13+
14+
<!-- Render Crispy Form -->
15+
{{ form|crispy }}
16+
17+
<!-- Submit Button -->
18+
<button type="submit"
19+
class="w-full bg-blue-500 hover:bg-blue-600 text-white py-2 px-4 rounded-lg shadow-md">
20+
Register
21+
</button>
22+
</form>
23+
</div>
1424
{% endblock %}

0 commit comments

Comments
 (0)