diff --git a/src/django_project/web/admin.py b/src/django_project/web/admin.py index 452340c..714c02f 100644 --- a/src/django_project/web/admin.py +++ b/src/django_project/web/admin.py @@ -38,10 +38,10 @@ class PresentationRequestAdmin(admin.ModelAdmin): "email", "title", "description", - "target_audience", + "skill_level", ] - search_fields: list[str] = ["id", "presenter", "email", "title", "description", "target_audience"] - list_filter: list[str] = ["target_audience"] + search_fields: list[str] = ["id", "presenter", "email", "title", "description", "skill_level"] + list_filter: list[str] = ["skill_level"] class EventAdmin(admin.ModelAdmin): diff --git a/src/django_project/web/forms.py b/src/django_project/web/forms.py index 7e5095e..3850e67 100644 --- a/src/django_project/web/forms.py +++ b/src/django_project/web/forms.py @@ -1,2 +1,40 @@ # import models -# from web.models import () +from handyhelpers.forms import HtmxModelForm +from web.models import PresentationRequest, TopicSuggestion + + +class PresentationRequestForm(HtmxModelForm): + hx_post: str = "/presentation_request" + hx_target: str = "presentation-request-form" + submit_button_text: str = "submit" + success_message: str = "presentation request submitted; thanks!" + + class Meta: + model = PresentationRequest + fields: list[str] = ["presenter", "email", "title", "description", "skill_level"] + + labels: dict[str, str] = { + "presenter": "Presenter Name", + "email": "Email Address", + "title": "Presentation Title", + "description": "Presentation Description", + "skill_level": "Skill Level", + } + + +class TopicSuggestionForm(HtmxModelForm): + hx_post: str = "/topic_suggestion" + hx_target: str = "topic-suggestion-form" + submit_button_text: str = "submit" + success_message: str = "topic suggestion submitted; thanks!" + + class Meta: + model = TopicSuggestion + fields: list[str] = ["title", "description", "skill_level", "email"] + + labels: dict[str, str] = { + "title": "Topic Title", + "description": "Topic Description", + "skill_level": "Skill Level", + "email": "Email Address (optional)", + } diff --git a/src/django_project/web/migrations/0003_rename_target_audience_presentationrequest_skill_level.py b/src/django_project/web/migrations/0003_rename_target_audience_presentationrequest_skill_level.py new file mode 100644 index 0000000..93a5b99 --- /dev/null +++ b/src/django_project/web/migrations/0003_rename_target_audience_presentationrequest_skill_level.py @@ -0,0 +1,17 @@ +# Generated by Django 5.2.4 on 2025-07-29 16:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("web", "0002_event_url"), + ] + + operations = [ + migrations.RenameField( + model_name="presentationrequest", + old_name="target_audience", + new_name="skill_level", + ), + ] diff --git a/src/django_project/web/models.py b/src/django_project/web/models.py index c81e242..4599aae 100644 --- a/src/django_project/web/models.py +++ b/src/django_project/web/models.py @@ -67,7 +67,7 @@ class PresentationRequest(HandyHelperBaseModel): email: models.EmailField = models.EmailField(max_length=254, null=False) title: models.CharField = models.CharField(max_length=128, null=False) description: models.TextField = models.TextField() - target_audience: models.CharField = models.CharField( + skill_level: models.CharField = models.CharField( max_length=64, null=False, choices=[ diff --git a/src/django_project/web/templates/web/full/index.html b/src/django_project/web/templates/web/full/index.html index 4c08f38..5da45be 100644 --- a/src/django_project/web/templates/web/full/index.html +++ b/src/django_project/web/templates/web/full/index.html @@ -6,10 +6,12 @@ - + - + @@ -96,6 +98,32 @@ } + + @@ -130,7 +158,8 @@

Welcome to S Group

A vibrant community of Python enthusiasts, learners, and professionals. Join us for engaging talks, workshops, and networking opportunities.

- Join Us + Join + Us @@ -201,7 +230,8 @@

Upcoming Events

-
+
@@ -213,9 +243,12 @@

Upcoming Events

Past Events

Check out what we've been up to

- +
@@ -228,10 +261,12 @@

Learning Resources
-
Beginner Resources
-
-
+
Beginner Resources
+
+
@@ -239,10 +274,12 @@
-
Web Development
-
-
+
Web Development
+
+
@@ -250,10 +287,12 @@
-
Data Science
-
-
+
Data Science
+
+
@@ -261,9 +300,12 @@
-
AI and Machine Learning
-
-
+
AI and Machine Learning
+
+
@@ -271,10 +313,12 @@
-
DevOps and Automation
-
-
+
DevOps and Automation
+
+
@@ -282,9 +326,13 @@
-
Science Computing
-
-
+
Science Computing
+
+
+
@@ -308,35 +356,49 @@

Get Involved

Suggest a Topic
-
+ + {% csrf_token %}
-
- - + +
-
- - +
+ +
-
- - +
-
- - +
+ +
- + + +
+
@@ -347,41 +409,56 @@
Volunteer to Present
-
+ + {% csrf_token %}
-
- - -
-
- - -
-
- - + +
-
- - +
+ +
-
- - + +
+
+ + +
+
+ + +
- + + +
+
@@ -402,10 +479,7 @@
Looking for more local tech?

Visit - - www.spokanetech.org - - for more local groups and events. + www.spokanetech.org for more local groups and events.

diff --git a/src/django_project/web/templates/web/partials/resource_list.htm b/src/django_project/web/templates/web/partials/resource_list.htm index d7405af..6211a96 100644 --- a/src/django_project/web/templates/web/partials/resource_list.htm +++ b/src/django_project/web/templates/web/partials/resource_list.htm @@ -1,5 +1,5 @@ {% for resource in resources %} -
+
{{ resource.name }}
{{ resource.description }}
diff --git a/src/django_project/web/urls/gui.py b/src/django_project/web/urls/gui.py index e1126e4..ae17e67 100644 --- a/src/django_project/web/urls/gui.py +++ b/src/django_project/web/urls/gui.py @@ -9,6 +9,10 @@ path("home/", gui.IndexView.as_view(), name="home"), # HTMX views path("htmx/resource-list//", gui.ResourceListPartialView.as_view(), name="htmx_resource_list"), - path("htmx/past-events/", gui.PastEvents.as_view(), name="htmx_past_events"), - path("htmx/future-events/", gui.FutureEvents.as_view(), name="htmx_future_events"), + path("htmx/past-events/", gui.PastEventsView.as_view(), name="htmx_past_events"), + path("htmx/future-events/", gui.FutureEventsView.as_view(), name="htmx_future_events"), + path( + "htmx/presentation-request/", gui.PresentationRequestFormRequestView.as_view(), name="htmx_presentation_request" + ), + path("htmx/topic-suggestion/", gui.TopicSuggestionFormRequestView.as_view(), name="htmx_topic_suggestion"), ] diff --git a/src/django_project/web/views/gui.py b/src/django_project/web/views/gui.py index f2b1649..8409c33 100644 --- a/src/django_project/web/views/gui.py +++ b/src/django_project/web/views/gui.py @@ -6,6 +6,10 @@ from django.utils import timezone from django.views import View from django.views.generic import TemplateView +from handyhelpers.views.htmx import ( + HtmxFormPostSimple, +) +from web.forms import PresentationRequestForm, TopicSuggestionForm from web.models import Event, Resource, ResourceCategory @@ -39,7 +43,7 @@ def get(self, request, pk) -> HttpResponse: ) -class PastEvents(View): +class PastEventsView(View): def get(self, request) -> HttpResponse: events: BaseManager[Event] = Event.objects.filter(start_date_time__lt=timezone.now()).order_by( "-start_date_time" @@ -47,9 +51,19 @@ def get(self, request) -> HttpResponse: return render(request, "web/partials/past_events.htm", {"events": events}) -class FutureEvents(View): +class FutureEventsView(View): def get(self, request) -> HttpResponse: events: BaseManager[Event] = Event.objects.filter(start_date_time__gte=timezone.now()).order_by( "start_date_time" ) return render(request, "web/partials/future_events.htm", {"events": events}) + + +class PresentationRequestFormRequestView(HtmxFormPostSimple): + form = PresentationRequestForm + success_message: str = "Presentation request received, thanks!" + + +class TopicSuggestionFormRequestView(HtmxFormPostSimple): + form = TopicSuggestionForm + success_message: str = "Topic suggestion received, thanks!"