Skip to content

Commit

Permalink
refactor(generic): replace templatetags with object getters
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed May 16, 2024
1 parent 3c80aef commit 31be790
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
5 changes: 2 additions & 3 deletions apis_core/generic/templates/columns/delete.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{% load apisgeneric %}
<a title="delete"
hx-delete="{% url "apis_core:generic:genericmodelapi-detail" record|contenttype record.id %}"
hx-delete="{{ record.get_api_detail_endpoint }}"
hx-confirm="Are your sure you want to delete {{ record }}?"
hx-target="closest tr"
hx-swap="outerHTML swap:0.3s"
href="{% url 'apis_core:generic:delete' record|contenttype record.id %}"
href="{{ record.get_delete_url }}"
class="text-danger"><span class="material-symbols-outlined">delete</span></a>
3 changes: 1 addition & 2 deletions apis_core/generic/templates/columns/description.html
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
{% load apisgeneric %}
<a href="{% url 'apis_core:generic:detail' record|contenttype record.id %}">{{ record }}</a>
<a href="{{ record.get_absolute_url }}">{{ record }}</a>
5 changes: 1 addition & 4 deletions apis_core/generic/templates/columns/edit.html
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
{% load apisgeneric %}
<a title="edit"
href="{% url 'apis_core:generic:update' record|contenttype record.id %}"
class="text-warning"><span class="material-symbols-outlined">edit</span></a>
<a title="edit" href="{{ record.get_edit_url }}" class="text-warning"><span class="material-symbols-outlined">edit</span></a>
3 changes: 1 addition & 2 deletions apis_core/generic/templates/columns/view.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{% load apisgeneric %}
<a title="view"
href="{% url 'apis_core:generic:detail' record|contenttype record.id %}"
href="{{ record.get_absolute_url }}"
class="text-success"><span class="material-symbols-outlined">visibility</span></a>

0 comments on commit 31be790

Please sign in to comment.