ambitious-london-57076
11/07/2021, 9:28 PMbrave-raincoat-81051
11/08/2021, 10:12 PMreturn render(request, 'booqmarqed_area.html', context)
brave-raincoat-81051
11/08/2021, 10:12 PMambitious-london-57076
11/09/2021, 9:08 AMHttpResponse(render(request, 'partials/boomarqed_area.html', context={'list':instance}))
The button click seems to work but now does not change until I manually reload the pageambitious-london-57076
11/09/2021, 9:11 AM{% load static %}
<ul hx-target="this" hx-swap="outerHTML" id="booqmarqedarea" role="group" aria-label="Basic example">
<li >booqmarqed {{list.bookmarked.count }} times</li>
<button hx-post="{% url 'booqmarqs:booqmarq_list' list.id %}"
id="booqmarq-button">
{% if request.user in list.bookmarked.all %}
<img src="{% static 'images/booqmarqed.png' %}" width="auto" height="20px">
{% else %}
<img src="{% static 'images/booqmarq.png' %}" width="auto" height="20px">
{% endif %}
</button>
</ul>
brave-raincoat-81051
11/09/2021, 2:34 PMambitious-london-57076
11/09/2021, 6:22 PMambitious-london-57076
11/09/2021, 6:23 PM<ul class="list-group list-group-horizontal btn-group" id="booqmarqedarea" role="group">
<li class="list-group-item">booqmarqed {{list.bookmarked.count }} times</li>
<button class="btn btn-outline-secondary" hx-post="{% url 'booqmarqs:booqmarq_list' list.id %}"
id="booqmarq-button" hx-target="#booqmarqedarea" hx-swap="outerHTML">
{% if request.user in list.bookmarked.all %}
<img src="{% static 'images/booqmarqed.png' %}" width="auto" height="20px">
{% else %}
<img src="{% static 'images/booqmarq.png' %}" width="auto" height="20px">
{% endif %}
</button>
</ul>
ambitious-london-57076
11/09/2021, 6:30 PMreturn render( request, 'booqmarqs/partials/boomarqed_area.html', context={'list':instance})
2. return HttpResponse(render( request, 'booqmarqs/partials/boomarqed_area.html', context={'list':instance}))
3. return HttpResponse( request, 'booqmarqs/partials/boomarqed_area.html', context={'list':instance})
All the samegorgeous-airport-54386
11/09/2021, 6:31 PMbrave-raincoat-81051
11/10/2021, 2:51 AMambitious-london-57076
11/10/2021, 11:14 AMvictorious-room-74725
11/10/2021, 3:36 PMvictorious-room-74725
11/10/2021, 3:40 PMambitious-london-57076
11/10/2021, 6:41 PMvictorious-room-74725
11/10/2021, 7:28 PMhundreds-camera-24900
11/11/2021, 2:27 AMhundreds-camera-24900
11/11/2021, 2:27 AMhundreds-camera-24900
11/11/2021, 2:27 AM<form
{% if anime.slug %}hx-post="{% url "anime-update" slug=anime.slug %}"
{% else %} hx-post="{% url "anime-create" %}"
{% endif %}
hx-swap="outerHTML" hx-indicator=".htmx-indicator" hx-push-url="false">
{{form.as_p}}
<input type="submit" value="Update Anime">
</form>
hundreds-camera-24900
11/11/2021, 2:27 AMclass AnimeWrite(UpdateView, HtmxTemplateResponseMixin):
template_name = "home/anime_update.html"
htmx_template_name = "home/partials/anime_form.html"
model = Anime
form_class = AnimeForm
def get_object(self):
self.anime = get_object_or_None(Anime, slug=self.kwargs.get("slug"))
return self.anime or Anime()
def form_valid(self, form):
"""If the form is valid, save the associated model."""
self.object = form.save()
return HttpResponseClientRedirect(self.get_success_url())
hundreds-camera-24900
11/11/2021, 2:28 AMhundreds-camera-24900
11/11/2021, 2:28 AMmysterious-toddler-20573
11/11/2021, 3:21 AMHX-Push
to push the URL for that view into historyhundreds-camera-24900
11/11/2021, 1:45 PMhundreds-camera-24900
11/11/2021, 1:45 PMmysterious-toddler-20573
11/11/2021, 2:28 PMmysterious-toddler-20573
11/11/2021, 2:28 PMHX-Retarget
response header, which would be useful in this casehundreds-camera-24900
11/11/2021, 2:30 PM