-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #527 from inflrscns/admin_panel
Admin panel
- Loading branch information
Showing
5 changed files
with
113 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{% extends "wiki/base.html" %} | ||
{% load i18n wiki_tags sekizai_tags %} | ||
|
||
{% block wiki_pagetitle %}{% trans "Admin Panel" %}{% endblock %} | ||
|
||
{% block wiki_contents %} | ||
|
||
<h1 class="page-header">{% trans "Deleted Articles" %}</h1> | ||
{% if deleted_articles %} | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>{% trans "Page Title" %}</th> | ||
<th>{% trans "Date Deleted" %}</th> | ||
<th>{% trans "Restore Article" %}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for article in deleted_articles %} | ||
<tr> | ||
<td><a href="{{article.get_absolute_url}}">{{ article }}</a></td> | ||
<td> {{article.modified}} </td> | ||
<td><a href="{% url 'wiki:deleted' article_id=article.id %}?restore=1" class="btn btn-default"><span class="fa fa-repeat"></span> | ||
{% trans "Restore" %}</a></td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% else %} | ||
<b> {% trans "No deleted articles to display" %} </b> | ||
{% endif %} | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from django.views.generic.base import TemplateView | ||
from django.shortcuts import redirect | ||
|
||
from wiki import models | ||
|
||
class DeletedListView(TemplateView): | ||
|
||
template_name = "wiki/deleted_list.html" | ||
|
||
def dispatch(self, request, *args, **kwargs): | ||
# Let logged in super users continue | ||
if not request.user.is_superuser: | ||
return redirect('wiki:root') | ||
|
||
return super(DeletedListView, self).dispatch(request, *args, **kwargs) | ||
|
||
def get_context_data(self, **kwargs): | ||
article_list = models.Article.objects.all() | ||
deleted_articles = [] | ||
for article in article_list: | ||
if(article.current_revision.deleted): | ||
deleted_articles.append(article) | ||
kwargs['deleted_articles'] = deleted_articles | ||
context = super(DeletedListView, self).get_context_data(**kwargs) | ||
return context |