can now delete posts and topics

This commit is contained in:
CDaut 2022-06-25 17:05:59 +02:00 committed by CDaut
parent 5bd92689e1
commit 6b0cd847c6
4 changed files with 26 additions and 5 deletions

View file

@ -1,7 +1,3 @@
.topic_list {
}
.topic_list_element {
box-shadow: 3px 3px 11px 4px rgb(231, 231, 231);
-webkit-box-shadow: 3px 3px 11px 4px rgb(231, 231, 231);
@ -16,4 +12,14 @@
-moz-box-shadow: 3px 3px 11px 4px rgb(231, 231, 231);
padding: 0.5em 0.5em 0.5em 1em;
margin: 2em 0.5em 0.5em 0;
}
.btn-danger {
background-color: #dc3545 !important;
margin-left: 3em;
}
span {
display: block !important;
margin: auto;
}

View file

@ -19,6 +19,11 @@
<li class="topic_list_element" draggable="true" ondragstart="drag(event)"
id="list_elem_post_{{ post.id }}">
<a href="{% url 'readpost' title=post.title %}">{{ post }}</a>
<a href="/admin/blog/blogpost/{{ post.id }}/delete">
<button class="btn waves-effect waves-light btn-danger">
<span class="material-icons">delete</span>
</button>
</a>
</li>
{% endif %}
{% endfor %}

View file

@ -1,6 +1,11 @@
{% load tree_utils %}
<li class="topic_list_element" draggable="true" ondragstart="drag(event)"
id="list_elem_{{ topic.id }}"> {{ topic.name }}
<a href="/admin/blog/topic/{{ topic.id }}/delete">
<button class="btn waves-effect waves-light btn-danger"><span class="material-icons">
delete
</span></button>
</a>
{% if topic|has_children %}
<ul class="topic_list" ondrop="drop(event)" ondragover="allowDrop(event)" id="list_{{ topic.id }}">
{% for child in topic|all_children %}
@ -16,6 +21,11 @@
<li class="topic_list_element" draggable="true" ondragstart="drag(event)"
id="list_elem_post_{{ post.id }}">
<a href="{% url 'readpost' title=post.title %}">{{ post }}</a>
<a href="/admin/blog/blogpost/{{ post.id }}/delete">
<button class="btn waves-effect waves-light btn-danger">
<span class="material-icons">delete</span>
</button>
</a>
</li>
{% endif %}
{% endfor %}

View file

@ -4,5 +4,5 @@ from django.urls import path, include
urlpatterns = [
path('', include('blog.urls')),
path('admin/', admin.site.urls),
path('auth/', include('django.contrib.auth.urls'))
path('accounts/', include('django.contrib.auth.urls'))
]