Skip to content

Commit

Permalink
Waiting messages
Browse files Browse the repository at this point in the history
  • Loading branch information
berk76 committed Mar 8, 2024
1 parent 67b72ed commit 9f189ce
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
29 changes: 29 additions & 0 deletions svjis/articles/templates/admin_messages.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% extends "base-with-aside-menu-content.html" %}

{% load i18n %}

{% block content %}

<h1 class="page-title" id="tbl-desc">{% trans 'Waiting messages' %}</h1>

<table class="list" width="100%" aria-describedby="tbl-desc">
<tr>
<th class="list" scope="col">&nbsp;</th>
<th class="list" scope="col">{% trans 'Recipient' %}</th>
<th class="list" scope="col">{% trans 'Subject' %}</th>
<th class="list" scope="col">{% trans 'Creation time' %}</th>
</tr>

{% if object_list %}
{% for obj in object_list %}
<tr>
<td class="list">{{ forloop.counter }}</td>
<td class="list">{{ obj.email }}</td>
<td class="list">{{ obj.subject }}</td>
<td class="list">{{ obj.creation_time | date:"d.m.Y H:i" }}</td>
</tr>
{% endfor %}
{% endif %}
</table>

{% endblock %}
1 change: 1 addition & 0 deletions svjis/articles/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
path('admin_group_edit/<int:pk>/', views_admin.admin_group_edit_view, name='admin_group_edit'),
path('admin_group_save/', views_admin.admin_group_save_view, name='admin_group_save'),
path('admin_group_delete/<int:pk>/', views_admin.admin_group_delete_view, name='admin_group_delete'),
path('admin_messages/', views_admin.admin_messages_view, name='admin_messages'),
]

if settings.DEBUG:
Expand Down
15 changes: 15 additions & 0 deletions svjis/articles/views_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def get_side_menu(active_item, user):
result.append({'description': _("Users"), 'link': reverse(admin_user_view), 'active': True if active_item == 'users' else False})
if user.has_perm('articles.svjis_edit_admin_groups'):
result.append({'description': _("Groups"), 'link': reverse(admin_group_view), 'active': True if active_item == 'groups' else False})
if user.has_perm('articles.svjis_edit_admin_groups'):
result.append({'description': _("Waiting messages"), 'link': reverse(admin_messages_view), 'active': True if active_item == 'messages' else False})
return result


Expand Down Expand Up @@ -176,3 +178,16 @@ def admin_group_delete_view(request, pk):
obj = get_object_or_404(Group, pk=pk)
obj.delete()
return redirect(admin_group_view)


# Administration - Waiting messages
@permission_required("articles.svjis_edit_admin_groups")
def admin_messages_view(request):
message_list = models.MessageQueue.objects.filter(status=0)
ctx = {
'aside_menu_name': _("Administration"),
}
ctx['aside_menu_items'] = get_side_menu('messages', request.user)
ctx['tray_menu_items'] = utils.get_tray_menu('admin', request.user)
ctx['object_list'] = message_list
return render(request, "admin_messages.html", ctx)

0 comments on commit 9f189ce

Please sign in to comment.