From 30a7a279f51596aa5c03b1b62d7226b9ae734f94 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Thu, 20 Jul 2023 08:42:11 -0500 Subject: posts: fixed a template bug in notes --- app/posts/templates/posts/note_form.html | 2 ++ app/posts/views.py | 5 +++++ 2 files changed, 7 insertions(+) (limited to 'app/posts') diff --git a/app/posts/templates/posts/note_form.html b/app/posts/templates/posts/note_form.html index 1ef1bd2..15797f2 100644 --- a/app/posts/templates/posts/note_form.html +++ b/app/posts/templates/posts/note_form.html @@ -15,10 +15,12 @@ {% endblock %} {% block js %} + {% if is_update %}{%else%} +{% endif %} {% endblock%} diff --git a/app/posts/views.py b/app/posts/views.py index a26e53a..ae8b1e4 100644 --- a/app/posts/views.py +++ b/app/posts/views.py @@ -39,6 +39,11 @@ class NoteCreateView(CreateView): class NoteUpdateView(UpdateView): model = Note fields = ['title', 'url', 'body_markdown', 'post'] + + def get_context_data(self, **kwargs): + context = super(NoteUpdateView, self).get_context_data(**kwargs) + context['is_update'] = True + return context def get_success_url(self): return reverse('posts:detail', kwargs={"pk": self.object.post.pk}) -- cgit v1.2.3-70-g09d2