From 129e788c7bd41be000ddc18dd5252a66fc1bee03 Mon Sep 17 00:00:00 2001 From: lxf Date: Sun, 6 Feb 2022 13:47:00 -0500 Subject: plan: added urls and views for camp ideas --- app/planner/templates/planner/base.html | 1 + app/planner/templates/planner/idea-list.html | 35 ++++++++++++++++++++++++++++ app/planner/templates/planner/list.html | 2 +- app/planner/urls.py | 11 +++++++++ app/planner/views.py | 11 ++++++++- 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 app/planner/templates/planner/idea-list.html (limited to 'app/planner') diff --git a/app/planner/templates/planner/base.html b/app/planner/templates/planner/base.html index 4de5ce7..b465910 100644 --- a/app/planner/templates/planner/base.html +++ b/app/planner/templates/planner/base.html @@ -15,6 +15,7 @@ {% block content %} {% endblock %} diff --git a/app/planner/templates/planner/idea-list.html b/app/planner/templates/planner/idea-list.html new file mode 100644 index 0000000..1a3007c --- /dev/null +++ b/app/planner/templates/planner/idea-list.html @@ -0,0 +1,35 @@ +{% extends 'planner/base.html' %} +{% load typogrify_tags %} +{% block pagetitle %}Luxagraf - Camping{% endblock %} + {% block content %} +
+
+ {% for object in object_list %} +
+

{{object.name}} edit

+
{{object.notes_html|safe|urlize}}
+
    + {% if object.has_water %}
  • water
  • {% endif %} + {% if object.has_dump %}
  • dump
  • {% endif %} + {% if object.has_electric %}
  • electric
  • {% endif %} +
+
{% endfor %} +
+ {% endblock %} + + {% block js %} + + + + +{% endblock %} diff --git a/app/planner/templates/planner/list.html b/app/planner/templates/planner/list.html index ce7650e..2fffe59 100644 --- a/app/planner/templates/planner/list.html +++ b/app/planner/templates/planner/list.html @@ -16,7 +16,7 @@ {% if object.has_electric %}
  • electric
  • {% endif %} {% endfor %} -
    +
    {% endblock %} {% block js %} diff --git a/app/planner/urls.py b/app/planner/urls.py index 2ccedc3..75b60ba 100644 --- a/app/planner/urls.py +++ b/app/planner/urls.py @@ -5,6 +5,17 @@ from . import views app_name = "luxplanner" urlpatterns = [ + path( + r'ideas', + views.CampIdeaListView.as_view(), + {'page':1}, + name="idealist" + ), + path( + r'ideas/add', + views.PlannerModelFormView.as_view(), + name="ideacreate" + ), path( r'camp/add', views.PlannerModelFormView.as_view(), diff --git a/app/planner/views.py b/app/planner/views.py index ea862ad..a23047f 100644 --- a/app/planner/views.py +++ b/app/planner/views.py @@ -6,7 +6,7 @@ from django.utils import timezone from django.conf import settings from utils.views import PaginatedListView -from .models import Camp +from .models import Camp, CampIdea class PlannerListView(PaginatedListView): @@ -64,3 +64,12 @@ class PlannerUpdateView(UpdateView): success_url = '/planner/' template_name = 'planner/update_form.html' + +class CampIdeaListView(PaginatedListView): + model = CampIdea + template_name = 'planner/idea-list.html' + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(CampIdeaListView, self).get_context_data(**kwargs) + return context -- cgit v1.2.3-70-g09d2