mirror of
https://github.com/ae-utbm/sith.git
synced 2026-09-09 22:09:14 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db44e4bd02 |
@@ -4,16 +4,12 @@
|
||||
{% trans %}Delete confirmation{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% if is_fragment %}
|
||||
|
||||
{# Don't display tabs and errors #}
|
||||
{% block tabs %}
|
||||
{% endblock %}
|
||||
{% block errors %}
|
||||
{% endblock %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% block file %}
|
||||
<h2>{% trans %}Delete confirmation{% endtrans %}</h2>
|
||||
|
||||
@@ -23,30 +19,32 @@
|
||||
{% set action = current %}
|
||||
{% endif %}
|
||||
|
||||
<form action="{{ action }}" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
<p>{% trans obj=object %}Are you sure you want to delete "{{ obj }}"?{% endtrans %}</p>
|
||||
<button
|
||||
<form
|
||||
method="post"
|
||||
{% if is_fragment %}
|
||||
hx-post="{{ action }}"
|
||||
hx-target="#content"
|
||||
hx-swap="innerHTML"
|
||||
{% endif %}
|
||||
>{% trans %}Confirm{% endtrans %}</button>
|
||||
|
||||
<button
|
||||
{% if is_fragment %}
|
||||
hx-get="{{ previous }}"
|
||||
hx-action="{{ action }}"
|
||||
hx-target="#content"
|
||||
hx-swap="innerHTML"
|
||||
{% else %}
|
||||
action="window.history.back()"
|
||||
action="{{ action }}"
|
||||
{% endif %}
|
||||
>{% trans %}Cancel{% endtrans %}</button>
|
||||
|
||||
>
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="{% trans %}Confirm{% endtrans %}" />
|
||||
</form>
|
||||
<form
|
||||
method="get"
|
||||
{% if is_fragment %}
|
||||
hx-action="{{ previous }}"
|
||||
hx-target="#content"
|
||||
hx-swap="innerHTML"
|
||||
{% else %}
|
||||
action="javascript:history.back();"
|
||||
{% endif %}
|
||||
>
|
||||
<input type="submit" name="cancel" value="{% trans %}Cancel{% endtrans %}" />
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
+6
-22
@@ -21,7 +21,7 @@
|
||||
# Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
from django.urls import path, re_path, register_converter
|
||||
from django.urls import path, register_converter
|
||||
from django.views.generic import RedirectView
|
||||
|
||||
from com.views import NewsListView
|
||||
@@ -193,27 +193,11 @@ urlpatterns = [
|
||||
name="user_gift_delete",
|
||||
),
|
||||
# File views
|
||||
re_path(r"^file/$", FileListView.as_view(), name="file_list"),
|
||||
re_path(
|
||||
r"^file/(?P<file_id>[0-9]+)/$",
|
||||
FileView.as_view(),
|
||||
name="file_detail",
|
||||
),
|
||||
re_path(
|
||||
r"^file/(?P<file_id>[0-9]+)/edit/$",
|
||||
FileEditView.as_view(),
|
||||
name="file_edit",
|
||||
),
|
||||
re_path(
|
||||
r"^file/(?P<file_id>[0-9]+)/prop/$",
|
||||
FileEditPropView.as_view(),
|
||||
name="file_prop",
|
||||
),
|
||||
re_path(
|
||||
r"^file/(?P<file_id>[0-9]+)/delete/$",
|
||||
FileDeleteView.as_view(),
|
||||
name="file_delete",
|
||||
),
|
||||
path("file/", FileListView.as_view(), name="file_list"),
|
||||
path("file/<int:file_id>/", FileView.as_view(), name="file_detail"),
|
||||
path("file/<int:file_id>/edit/", FileEditView.as_view(), name="file_edit"),
|
||||
path("file/<int:file_id>/prop/", FileEditPropView.as_view(), name="file_prop"),
|
||||
path("file/<int:file_id>/delete/", FileDeleteView.as_view(), name="file_delete"),
|
||||
path("file/moderation/", FileModerationView.as_view(), name="file_moderation"),
|
||||
path(
|
||||
"file/<int:file_id>/moderate/", FileModerateView.as_view(), name="file_moderate"
|
||||
|
||||
+2
-9
@@ -356,15 +356,8 @@ class FileDeleteView(AllowFragment, CanEditPropMixin, DeleteView):
|
||||
if "next" in self.request.GET:
|
||||
return self.request.GET["next"]
|
||||
if self.object.parent is None:
|
||||
return reverse(
|
||||
"core:file_list",
|
||||
)
|
||||
return reverse(
|
||||
"core:file_detail",
|
||||
kwargs={
|
||||
"file_id": self.object.parent.id,
|
||||
},
|
||||
)
|
||||
return reverse("core:file_list")
|
||||
return reverse("core:file_detail", kwargs={"file_id": self.object.parent.id})
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super().get_context_data(**kwargs)
|
||||
|
||||
Reference in New Issue
Block a user