musician filter context domains

This commit is contained in:
Jorge Pastor 2024-12-03 12:29:24 +01:00
parent d03472a123
commit 456a193d10
2 changed files with 15 additions and 0 deletions

View file

@ -5,6 +5,17 @@
<h1 class="service-name">{% trans "Your domains" %}</h1> <h1 class="service-name">{% trans "Your domains" %}</h1>
<div class="mt-4 search-form">
<form method="get" class="form-inline">
<div class="form-group mr-sm-2">
<label class="sr-only" for="id_name">Name</label>
<input type="text" name="name" class="form-control" placeholder="{% trans 'Domain' %}" title="" id="id_name">
</div>
<button type="submit" class="btn btn-secondary">{% trans "Search" %}</button>
</form>
</div>
<br>
{% for domain in domains %} {% for domain in domains %}
<div class="card service-card"> <div class="card service-card">
<div class="card-header"> <div class="card-header">

View file

@ -263,6 +263,10 @@ class DomainListView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
domains = self.orchestra.retrieve_domain_list() domains = self.orchestra.retrieve_domain_list()
name = self.request.GET.get('name')
if name:
domains = domains.filter(name__icontains=name)
support_email = getattr(settings, "USER_SUPPORT_EMAIL", "suport@pangea.org") support_email = getattr(settings, "USER_SUPPORT_EMAIL", "suport@pangea.org")
support_email_anchor = format_html( support_email_anchor = format_html(
"<a href='mailto:{}'>{}</a>", "<a href='mailto:{}'>{}</a>",