handsome-shampoo-48908
07/14/2022, 3:19 PMrefined-waiter-90422
07/14/2022, 3:32 PMhandsome-shampoo-48908
07/14/2022, 3:38 PMmelodic-advantage-28381
07/15/2022, 9:13 PMbumpy-zoo-26881
07/17/2022, 9:37 AMacceptable-student-40393
07/17/2022, 10:31 AMacceptable-student-40393
07/17/2022, 10:33 AM<div id="search_results" @htmx:before-swap="console.log('Hello World!')">
..stuff here ...
</div>
But that doesn't seem to fire off the console log. Would appreciate any pointers in the right direction.ripe-action-67367
07/17/2022, 11:35 AMripe-action-67367
07/17/2022, 11:36 AMcalm-queen-64495
07/18/2022, 2:45 AMblue-ghost-19146
07/18/2022, 6:51 AMPaginator
class, accessing the data in the template, choosing the correct hx-
attributes?blue-ghost-19146
07/18/2022, 6:51 AMcalm-queen-64495
07/18/2022, 6:59 AMclass ClientList(ListView):
model = User
template_name = 'clients.html'
paginate_by = 4
context_object_name = 'people'
def get_template_names(self):
if self.request.htmx:
return 'partials/client_card.html'
return 'clients.html'
def get_queryset(self):
return User.objects.all().exclude(admin = True)
def client_search(request):
if request.method == "POST":
search = request.POST['search']
people = User.objects.filter(Q(firstname__icontains=search) | Q(lastname__icontains=search)).exclude(admin = True)
context = {
'people': people
}
return render(request, 'partials/client_card.html', context)
calm-queen-64495
07/18/2022, 7:00 AMcalm-queen-64495
07/18/2022, 7:00 AMcalm-queen-64495
07/18/2022, 7:01 AM{% for person in people %}
{% if forloop.last %}
<div hx-get="{% url 'clients' %}?page={{ page_obj.number|add:1 }}" hx-trigger="revealed" hx-swap="afterend" hx-target="this" class="col col-md-6 col-12 col-xl-4" style="padding: 0;">
{% else %}
<div class="col col-md-6 col-12 col-xl-4" style="padding: 0;">
{% endif %}
<div class="card" style="margin: 5px;">
<div class="card-body" style="margin: 0;">
<div class="row">
<div class="col text-center align-self-center"><img class="rounded-circle people-face bg-light" src="{{person.profile_image.url}}"><i class="fa fa-female people-icon" data-bs-toggle="tooltip" data-bss-tooltip="" title="Female"></i></div>
</div>
<h4 class="text-primary card-title">
<a href="{% url 'admin-view-client' person.pk %}">{{person.get_full_name}}</a>
</h4>
<h6 class="text-muted card-subtitle mb-2"><em>{{person.suburb}}</em></h6>
<h6 class="text-muted card-subtitle mb-2" style="font-size: 13px;">NDIS: 4306734567, MANAGER: Woov Pay</h6>
<p class="card-text">Next Booking: <strong>16/6/2022</strong></p>
<div class="row" style="padding: 0;">
<div class="col"><i class="fa fa-phone-square fs-1 text-primary" style="margin: 5px;"></i><i class="fa fa-envelope-square fs-1 text-primary" style="margin: 5px;"></i></div>
</div>
</div>
</div>
</div>
{% endfor %}
calm-queen-64495
07/18/2022, 7:01 AMcalm-queen-64495
07/18/2022, 7:01 AMhundreds-camera-24900
07/18/2022, 6:01 PMhundreds-camera-24900
07/18/2022, 6:01 PMblue-ghost-19146
07/18/2022, 7:32 PMhx-get="{% url 'clients' %}?page={{ page_obj.next_page_number }}"
instead of .number|add:1
. Gone's example looks good - does it help solve your issue at all?icy-scooter-3369
07/18/2022, 9:25 PMicy-scooter-3369
07/18/2022, 9:27 PMblue-ghost-19146
07/18/2022, 9:54 PMblue-ghost-19146
07/18/2022, 9:54 PMicy-scooter-3369
07/18/2022, 10:50 PM