SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit ae474dbd authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Base

parent 776ae2d6
No related branches found
No related tags found
No related merge requests found
...@@ -125,6 +125,12 @@ class Journal(models.Model): ...@@ -125,6 +125,12 @@ class Journal(models.Model):
def has_issues(self): def has_issues(self):
return self.structure in (ISSUES_AND_VOLUMES, ISSUES_ONLY) return self.structure in (ISSUES_AND_VOLUMES, ISSUES_ONLY)
@property
def get_latest_issue(self):
if not self.has_issues:
return None
return Issue.obejcts....
@property @property
def has_volumes(self): def has_volumes(self):
return self.structure in (ISSUES_AND_VOLUMES) return self.structure in (ISSUES_AND_VOLUMES)
......
{% extends 'scipost/_personal_page_base.html' %}
{% block pagetitle %}{{block.super}}: Issues Admin{% endblock pagetitle %}
{% block breadcrumb_items %}
{{block.super}}
<span class="breadcrumb-item active">Issues Admin</span>
{% endblock %}
{% block content %}
<div class="row">
<div class="col-12">
<h1 class="highlight">Issues Admin</h1>
<a href="javascript:;">Create a new Issue</a>
<br><br>
<h3>Journals with their latest Issue</h3>
<table class="table">
<thead>
<tr>
<th>Journal</th>
<th>Latest Issue</th>
<th>Has active Issue?</th>
</tr>
</thead>
{% for journal in journals %}
{% if journal.has_issues %}
<tr>
<td>{{ journal.get_name_display }}</td>
<td></td>
<td><i class="fa fa-exclamation-triangle text-warning"></i> No.</td>
</tr>
{% endif %}
{% endfor %}
</table>
</div>
</div>
{% endblock %}
...@@ -103,6 +103,17 @@ urlpatterns = [ ...@@ -103,6 +103,17 @@ urlpatterns = [
journals_views.add_associated_grant, journals_views.add_associated_grant,
name='add_associated_grant'), name='add_associated_grant'),
url(r'^admin/issues/$',
journals_views.IssuesAdminListView.as_view(),
name='admin_issue_list'),
url(r'^admin/issues/add$',
journals_views.IssuesAdminAddView.as_view(),
name='add_issue'),
url(r'^admin/issues/(?P<id>[0-9]+)/$',
journals_views.IssuesAdminUpdateView.as_view(),
name='update_issue'),
# Metadata handling # Metadata handling
url(r'^admin/(?P<doi_label>{regex})/metadata/crossref/create$'.format( url(r'^admin/(?P<doi_label>{regex})/metadata/crossref/create$'.format(
regex=PUBLICATION_DOI_REGEX), regex=PUBLICATION_DOI_REGEX),
......
...@@ -24,7 +24,7 @@ from django.http import Http404, HttpResponse ...@@ -24,7 +24,7 @@ from django.http import Http404, HttpResponse
from django.utils import timezone from django.utils import timezone
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from django.views.generic.edit import UpdateView from django.views.generic.edit import CreateView, UpdateView
from django.views.generic.list import ListView from django.views.generic.list import ListView
from django.shortcuts import get_object_or_404, get_list_or_404, render, redirect from django.shortcuts import get_object_or_404, get_list_or_404, render, redirect
...@@ -177,6 +177,30 @@ class IssuesView(DetailView): ...@@ -177,6 +177,30 @@ class IssuesView(DetailView):
template_name = 'journals/journal_issues.html' template_name = 'journals/journal_issues.html'
class IssuesAdminListView(PermissionsMixin, ListView):
"""
List all Issues in the database for the admin.
"""
model = Issue
permission_required = 'scipost.can_manage_issues'
class IssuesAdminAddView(PermissionsMixin, CreateView):
"""
List all Issues in the database for the admin.
"""
model = Issue
permission_required = 'scipost.can_manage_issues'
class IssuesAdminUpdateView(PermissionsMixin, UpdateView):
"""
List all Issues in the database for the admin.
"""
model = Issue
permission_required = 'scipost.can_manage_issues'
def redirect_to_about(request, doi_label): def redirect_to_about(request, doi_label):
journal = get_object_or_404(Journal, doi_label=doi_label) journal = get_object_or_404(Journal, doi_label=doi_label)
return redirect( return redirect(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment