From cdbcc2b3ab09c5bc6d4abecdb8c375ba1593d899 Mon Sep 17 00:00:00 2001 From: Sheena Date: Wed, 20 Nov 2024 10:51:09 +0200 Subject: [PATCH] create form shows up --- proposals/forms.py | 17 +++++++++++ proposals/urls.py | 10 ++++++ proposals/views.py | 12 ++++++-- static/src/tailwind_final.css | 11 +++++++ templates/proposals/create_proposal.html | 39 ++++++++++++++++++++++++ templates/proposals/my_proposals.html | 2 +- 6 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 proposals/forms.py create mode 100644 templates/proposals/create_proposal.html diff --git a/proposals/forms.py b/proposals/forms.py new file mode 100644 index 0000000..a1a373e --- /dev/null +++ b/proposals/forms.py @@ -0,0 +1,17 @@ +from django import forms +from . import models + + +class ProposalForm(forms.ModelForm): + class Meta: + model = models.Proposal + fields = [ + "title", + "proposal_type", + "track", + "description", + "private_notes", + "additional_speaker_emails", + "audience_level", + "accessibility_requests", + ] diff --git a/proposals/urls.py b/proposals/urls.py index df99035..6e72f04 100644 --- a/proposals/urls.py +++ b/proposals/urls.py @@ -9,4 +9,14 @@ views.action_delete_my_proposal, name="action_delete_my_proposal", ), + path( + "my_proposals/create", + views.create_proposal, + name="create_proposal", + ), + # path( + # "my_proposals/create", + # views.action_create_proposal_submit, + # name="action_create_proposal_submit", + # ), ] diff --git a/proposals/views.py b/proposals/views.py index 2c94ec1..e104f63 100644 --- a/proposals/views.py +++ b/proposals/views.py @@ -1,8 +1,9 @@ from django.shortcuts import render from django.contrib.auth.decorators import login_required -from django.http import HttpResponse, Http404 -from . import models +from django.http import Http404 from django.shortcuts import get_object_or_404 +from . import models +from . import forms @login_required @@ -27,3 +28,10 @@ def action_delete_my_proposal(request, proposal_id): context = {"proposals": proposals} return render(request, "proposals/my_proposals.html#table_body", context) + + +@login_required +def create_proposal(request): + form = forms.ProposalForm() + context = {"form": form} + return render(request, "proposals/create_proposal.html", context) diff --git a/static/src/tailwind_final.css b/static/src/tailwind_final.css index 9dc9056..58f3478 100644 --- a/static/src/tailwind_final.css +++ b/static/src/tailwind_final.css @@ -957,6 +957,12 @@ td { margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))); } +.space-y-6 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); +} + .rounded { border-radius: 0.25rem; } @@ -1173,6 +1179,11 @@ td { line-height: 1rem; } +.text-xl { + font-size: 1.25rem; + line-height: 1.75rem; +} + .font-bold { font-weight: 700; } diff --git a/templates/proposals/create_proposal.html b/templates/proposals/create_proposal.html new file mode 100644 index 0000000..724e1a9 --- /dev/null +++ b/templates/proposals/create_proposal.html @@ -0,0 +1,39 @@ +{% extends "_base.html" %} +{% load tailwind_filters %} + +{% load partials %} + +{% partialdef form %} + + +{% if form.errors %} +
+ +

Please correct the errors below. +

+ {% endif %} + + +
+ {{ form | crispy}} +
+ +
+
+ +
+ +{% endpartialdef %} + + + +{% block content %} + +

Create new proposal

+ +{% partial form %} + +{% endblock content %} \ No newline at end of file diff --git a/templates/proposals/my_proposals.html b/templates/proposals/my_proposals.html index 0b2f47f..8fe8638 100644 --- a/templates/proposals/my_proposals.html +++ b/templates/proposals/my_proposals.html @@ -53,7 +53,7 @@

My Proposals

- Create new proposal + Create new proposal
{% endblock content %} \ No newline at end of file