Commit 0a84ef84 authored by Skia's avatar Skia

Allow to unmoderate news

parent 231cb236
Pipeline #990 passed with stage
in 4 minutes and 53 seconds
......@@ -36,7 +36,8 @@
<td>{{ news.dates.first().end_date|localtime|date(DATETIME_FORMAT) }}
{{ news.dates.first().end_date|localtime|time(DATETIME_FORMAT) }}</td>
<td><a href="{{ url('com:news_detail', news_id=news.id) }}">{% trans %}View{% endtrans %}</a>
<a href="{{ url('com:news_edit', news_id=news.id) }}">{% trans %}Edit{% endtrans %}</a> </td>
<a href="{{ url('com:news_edit', news_id=news.id) }}">{% trans %}Edit{% endtrans %}</a>
<a href="{{ url('com:news_moderate', news_id=news.id) }}?remove">{% trans %}Remove{% endtrans %}</a></td>
</tr>
{% endfor %}
</tbody>
......
......@@ -26,6 +26,9 @@ section.news_event:nth-of-type(even) {
{% block content %}
<h3>{% trans %}News{% endtrans %}</h3>
{% if user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) %}
<a href="{{ url('com:news_admin_list') }}">{% trans %}Administrate news{% endtrans %}</a>
{% endif %}
{% for news in object_list.filter(type="NOTICE") %}
<section class="news_notice">
<h4> <a href="{{ url('com:news_detail', news_id=news.id) }}">{{ news.title }}</a></h4>
......
......@@ -192,7 +192,7 @@ class NewsEditView(CanEditMixin, UpdateView):
Notification(user=u, url=reverse("com:news_detail", kwargs={'news_id': self.object.id}), type="NEWS_MODERATION").save()
return super(NewsEditView, self).form_valid(form)
class NewsCreateView(CanCreateMixin, CreateView): #XXX no can_be_created_by function in News model
class NewsCreateView(CanCreateMixin, CreateView):
model = News
form_class = NewsForm
template_name = 'com/news_edit.jinja'
......@@ -230,6 +230,9 @@ class NewsModerateView(CanEditMixin, SingleObjectMixin):
def get(self, request, *args, **kwargs):
self.object = self.get_object()
if 'remove' in request.GET.keys():
self.object.is_moderated = False
else:
self.object.is_moderated = True
self.object.moderator = request.user
self.object.save()
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment