mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 15:51:19 +00:00
com: add NewsDeleteView
Signed-off-by: Skia <skia@libskia.so>
This commit is contained in:
parent
6456d18fc4
commit
4c1b231ec9
@ -8,6 +8,8 @@
|
||||
{% block content %}
|
||||
<h3>{% trans %}News{% endtrans %}</h3>
|
||||
|
||||
<p><a href="{{ url('com:news_new') }}">{% trans %}Create news{% endtrans %}</a></p>
|
||||
|
||||
<hr />
|
||||
<h4>{% trans %}Notices{% endtrans %}</h4>
|
||||
{% set notices = object_list.filter(type="NOTICE").distinct().order_by('id') %}
|
||||
@ -35,7 +37,9 @@
|
||||
<td>{{ user_profile_link(news.moderator) }}</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>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}?remove">{% trans %}Remove{% endtrans %}</a></td>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}?remove">{% trans %}Remove{% endtrans %}</a>
|
||||
<a href="{{ url('com:news_delete', news_id=news.id) }}">{% trans %}Delete{% endtrans %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@ -62,7 +66,9 @@
|
||||
<td>{{ user_profile_link(news.author) }}</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>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}">{% trans %}Moderate{% endtrans %}</a></td>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}">{% trans %}Moderate{% endtrans %}</a>
|
||||
<a href="{{ url('com:news_delete', news_id=news.id) }}">{% trans %}Delete{% endtrans %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@ -107,7 +113,9 @@
|
||||
</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>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}?remove">{% trans %}Remove{% endtrans %}</a></td>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}?remove">{% trans %}Remove{% endtrans %}</a>
|
||||
<a href="{{ url('com:news_delete', news_id=news.id) }}">{% trans %}Delete{% endtrans %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@ -146,7 +154,9 @@
|
||||
</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>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}">{% trans %}Moderate{% endtrans %}</a></td>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}">{% trans %}Moderate{% endtrans %}</a>
|
||||
<a href="{{ url('com:news_delete', news_id=news.id) }}">{% trans %}Delete{% endtrans %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@ -185,7 +195,9 @@
|
||||
{{ 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>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}?remove">{% trans %}Remove{% endtrans %}</a></td>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}?remove">{% trans %}Remove{% endtrans %}</a>
|
||||
<a href="{{ url('com:news_delete', news_id=news.id) }}">{% trans %}Delete{% endtrans %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@ -218,7 +230,9 @@
|
||||
{{ 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>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}">{% trans %}Moderate{% endtrans %}</a></td>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}">{% trans %}Moderate{% endtrans %}</a>
|
||||
<a href="{{ url('com:news_delete', news_id=news.id) }}">{% trans %}Delete{% endtrans %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@ -257,7 +271,9 @@
|
||||
{{ 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>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}?remove">{% trans %}Remove{% endtrans %}</a></td>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}?remove">{% trans %}Remove{% endtrans %}</a>
|
||||
<a href="{{ url('com:news_delete', news_id=news.id) }}">{% trans %}Delete{% endtrans %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@ -290,7 +306,9 @@
|
||||
{{ 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>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}">{% trans %}Moderate{% endtrans %}</a></td>
|
||||
<a href="{{ url('com:news_moderate', news_id=news.id) }}">{% trans %}Moderate{% endtrans %}</a>
|
||||
<a href="{{ url('com:news_delete', news_id=news.id) }}">{% trans %}Delete{% endtrans %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
@ -40,6 +40,7 @@ urlpatterns = [
|
||||
url(r'^news$', NewsListView.as_view(), name='news_list'),
|
||||
url(r'^news/admin$', NewsAdminListView.as_view(), name='news_admin_list'),
|
||||
url(r'^news/create$', NewsCreateView.as_view(), name='news_new'),
|
||||
url(r'^news/(?P<news_id>[0-9]+)/delete$', NewsDeleteView.as_view(), name='news_delete'),
|
||||
url(r'^news/(?P<news_id>[0-9]+)/moderate$', NewsModerateView.as_view(), name='news_moderate'),
|
||||
url(r'^news/(?P<news_id>[0-9]+)/edit$', NewsEditView.as_view(), name='news_edit'),
|
||||
url(r'^news/(?P<news_id>[0-9]+)$', NewsDetailView.as_view(), name='news_detail'),
|
||||
|
@ -244,6 +244,11 @@ class NewsCreateView(CanCreateMixin, CreateView):
|
||||
return super(NewsCreateView, self).form_valid(form)
|
||||
|
||||
|
||||
class NewsDeleteView(CanEditMixin, DeleteView):
|
||||
model = News
|
||||
pk_url_kwarg = 'news_id'
|
||||
template_name = 'core/delete_confirm.jinja'
|
||||
|
||||
class NewsModerateView(CanEditMixin, SingleObjectMixin):
|
||||
model = News
|
||||
pk_url_kwarg = 'news_id'
|
||||
|
Loading…
Reference in New Issue
Block a user