diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/planner/templates/planner/list.html | 6 | ||||
-rw-r--r-- | app/planner/urls.py | 9 | ||||
-rw-r--r-- | app/planner/views.py | 22 |
3 files changed, 33 insertions, 4 deletions
diff --git a/app/planner/templates/planner/list.html b/app/planner/templates/planner/list.html index ac8dddf..64f0f57 100644 --- a/app/planner/templates/planner/list.html +++ b/app/planner/templates/planner/list.html @@ -10,8 +10,10 @@ <h6 class="date">Arrive: {{object.date_arrive|date:"D"}} Afternoon, {{object.date_arrive|date:"M j, Y"}}</h6> <h6 class="date">Depart: {{object.date_depart|date:"D"}} Morning, {{object.date_depart|date:"M j, Y"}}</h6> <div class="notes">{{object.notes_html|safe|urlize}}</div> - <ul> - {% if object.has_water %}<li class="water"> + <ul class="icons"> + {% if object.has_water %}<li class="water">water</li>{% endif %} + {% if object.has_dump %}<li class="water">dump</li>{% endif %} + {% if object.has_electric %}<li class="water">electric</li>{% endif %} </article>{% endfor %} </div> {% endblock %} diff --git a/app/planner/urls.py b/app/planner/urls.py index b9bd2b1..2ccedc3 100644 --- a/app/planner/urls.py +++ b/app/planner/urls.py @@ -5,12 +5,17 @@ from . import views app_name = "luxplanner" urlpatterns = [ - re_path( + path( r'camp/add', views.PlannerModelFormView.as_view(), name="create" ), - re_path( + path( + r'camp/edit/<int:pk>/', + views.PlannerUpdateView.as_view(), + name="update" + ), + path( r'', views.PlannerListView.as_view(), {'page':1}, diff --git a/app/planner/views.py b/app/planner/views.py index b89506a..ea862ad 100644 --- a/app/planner/views.py +++ b/app/planner/views.py @@ -32,6 +32,7 @@ class PlannerModelFormView(CreateView): 'distance_from_previous', 'notes', 'link', + 'map_link', 'price', 'site_number', 'has_water', @@ -42,3 +43,24 @@ class PlannerModelFormView(CreateView): success_url = '/planner/' template_name = 'planner/create_form.html' + +class PlannerUpdateView(UpdateView): + model = Camp + fields = [ + 'name', + 'date_arrive', + 'date_depart', + 'distance_from_previous', + 'notes', + 'link', + 'map_link', + 'price', + 'site_number', + 'has_water', + 'has_electric', + 'has_dump', + 'point', + ] + success_url = '/planner/' + template_name = 'planner/update_form.html' + |