Skip to content

Commit

Permalink
added new fields to templates
Browse files Browse the repository at this point in the history
  • Loading branch information
csae8092 committed Nov 9, 2023
1 parent 7e331ea commit 0d9c323
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 4 deletions.
6 changes: 3 additions & 3 deletions archiv/fixtures/dump.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
},
{
"model": "archiv.yearbook",
"pk": 663,
"pk": 642,
"fields": {
"title": "A. Anfinsen & B. Askeland Norway in: H. Koziol/B.C. Steininger (eds.), European Tort Law 2009 (2010)",
"title": "A. Bitāns, Latvia in: H. Koziol/B.C. Steininger (eds.), European Tort Law 2008 (2009)",
"doi": null,
"part_of": null
}
Expand Down Expand Up @@ -158,7 +158,7 @@
"fields": {
"title": "I.C. Durant, Belgium, in: H. Koziol/B.C. Steininger (eds.), European Tort Law 2005 (2006)",
"doi": "https://doi.org/10.1515/tortlaw-2022-frontmatter1",
"part_of": 663
"part_of": 642
}
},
{
Expand Down
15 changes: 15 additions & 0 deletions archiv/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class YearBookForm(forms.ModelForm):
class Meta:
model = YearBook
fields = "__all__"
widgets = {
"part_of": autocomplete.ModelSelect2(url="archiv-ac:yearbook-autocomplete")
}

def __init__(self, *args, **kwargs):
super(YearBookForm, self).__init__(*args, **kwargs)
Expand Down Expand Up @@ -134,6 +137,18 @@ class Meta:
]
widgets = {
"tag": autocomplete.ModelSelect2Multiple(url="archiv-ac:tag-autocomplete"),
"related_decision": autocomplete.ModelSelect2Multiple(
url="archiv-ac:courtdecission-autocomplete"
),
"author": autocomplete.ModelSelect2Multiple(
url="archiv-ac:person-autocomplete"
),
"keyword": autocomplete.ModelSelect2Multiple(
url="archiv-ac:keyword-autocomplete"
),
"year_book_title": autocomplete.ModelSelect2(
url="archiv-ac:yearbook-autocomplete"
),
}

def __init__(self, *args, **kwargs):
Expand Down
6 changes: 6 additions & 0 deletions archiv/templates/archiv/court_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,25 @@ <h2>Highcourt</h2>
</p>
{% endif %}
</p>
<h2>Court name (translated)</h2>
<p class="ps-5">{{ object.name_english }}</p>
{% if object.country %}
<h2>Country</h2>
<p class="ps-5">{{ object.country }}
<a href="{{ object.country.get_absolute_url }}">
<i class="bi bi bi-link-45deg"></i>
</a>
</p>
{% endif %}
<h2>Legal System</h2>
<p class="ps-5">
{{ object.partial_legal_system.name }}
<a href="{{ object.partial_legal_system.get_absolute_url }}">
<i class="bi bi bi-link-45deg"></i>
</a>
</p>
<h2>Optional notes</h2>
<p class="ps-5">{{ object.note }}</p>
{% with courtdecissions=object.rvn_courtdecission_court_court %}
<h2>{{ courtdecissions.count }} issued Court Decissions</h2>
{% include "archiv/partials/courtdecission_table.html" %}
Expand Down
5 changes: 5 additions & 0 deletions archiv/templates/archiv/courtdecission_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ <h2 class="text-center">Reference Case Nr. {{ object.id }}</h2>
<dd class="ms-5"><span class="badge rounded-pill text-bg-success ">{{ x }}</span> <a
href="{{ x.get_absolute_url }}"><i class="bi bi-link-45deg"></i></a></dd>
{% endfor %}
<dt>Related Cases</dt>
{% for x in object.related_decision.all %}
<dd class="ms-5"><span class="badge rounded-pill text-bg-warning ">{{ x }}</span> <a
href="{{ x.get_absolute_url }}"><i class="bi bi-link-45deg"></i></a></dd>
{% endfor %}
</dl>
<h2>The Case</h2>
<h3>Brief Description</h3>
Expand Down
17 changes: 16 additions & 1 deletion archiv/templates/archiv/yearbook_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,22 @@ <h1 class="text-center">
</div>
</div>
<div class="card-body container">

{% if object.part_of %}
<div class="text-center">
<h2>Parent Item</h2>
<a href="{{ object.part_of.get_absolute_url }}">{{ object.part_of }}</a>
</div>
{% endif %}

{% if object.has_bibliographic_items.all %}
<h2 class="text-center">has bibliographic items</h2>
<ul>
{% for x in object.has_bibliographic_items.all %}
<li> <a href="{{ x.get_absolute_url }}">{{ x }}</a></li>
{% endfor %}
</ul>
{% endif %}

{% if object.doi %}
<div class="text-center">
<h2>DOI</h2>
Expand Down

0 comments on commit 0d9c323

Please sign in to comment.