Skip to content

Commit

Permalink
more case-form (styling) things #43
Browse files Browse the repository at this point in the history
  • Loading branch information
csae8092 committed Apr 22, 2024
1 parent fd0a87a commit 71ca517
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
ignore = D203 W504
ignore = D203 W504 W503
max-line-length = 120
exclude =
*/migrations,
Expand Down
13 changes: 12 additions & 1 deletion archiv/dal_views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# generated by appcreator
from dal import autocomplete
from django.db.models import Q
from django.utils.html import format_html

from .models import Court
from .models import CourtDecission
Expand Down Expand Up @@ -30,11 +31,18 @@ def get_queryset(self):


class CourtAC(autocomplete.Select2QuerySetView):
def get_result_label(self, item):
return f"{item.name} ({item.name_english}) {item.abbreviation}"

def get_queryset(self):
qs = Court.objects.all()

if self.q:
qs = qs.filter(Q(name__icontains=self.q))
qs = qs.filter(
Q(name__icontains=self.q)
| Q(name_english__icontains=self.q)
| Q(abbreviation__startswith=self.q)
)
return qs


Expand All @@ -48,6 +56,9 @@ def get_queryset(self):


class KeyWordAC(autocomplete.Select2QuerySetView):
def get_result_label(self, result):
return format_html('<span class="badge rounded-pill text-bg-primary ">{}</span>', result.name)

def get_queryset(self):
qs = KeyWord.objects.all()

Expand Down
6 changes: 6 additions & 0 deletions archiv/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ class CourtDecissionListFilter(django_filters.FilterSet):
help_text=CourtDecission._meta.get_field("file_number").help_text,
label=CourtDecission._meta.get_field("file_number").verbose_name,
)
ecli = django_filters.CharFilter(
lookup_expr="icontains",
help_text=CourtDecission._meta.get_field("ecli").help_text,
label=CourtDecission._meta.get_field("ecli").verbose_name,
)
party = django_filters.CharFilter(
lookup_expr="icontains",
help_text=CourtDecission._meta.get_field("party").help_text,
Expand Down Expand Up @@ -173,6 +178,7 @@ class CourtDecissionListFilter(django_filters.FilterSet):
label=CourtDecission._meta.get_field("keyword").verbose_name,
widget=autocomplete.Select2Multiple(
url="archiv-ac:keyword-autocomplete",
attrs={'data-html': True}
),
)
author = django_filters.ModelMultipleChoiceFilter(
Expand Down
2 changes: 1 addition & 1 deletion archiv/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def __init__(self, *args, **kwargs):
"author",
css_id="extended",
),
always_open=True
always_open=True,
)
)

Expand Down
12 changes: 12 additions & 0 deletions webpage/static/webpage/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@
nav[data-toggle='toc'] .nav .nav {
display: block;
}


.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: var(--bs-body-bg)!important;
border: 1px solid var(--bs-body-bg) !important;
border-radius: 4px;
cursor: default;
float: left;
margin-right: 5px;
margin-top: 5px;
padding: 0 5px;
}

0 comments on commit 71ca517

Please sign in to comment.