diff --git a/journals/models.py b/journals/models.py index 19be6ee4c6e75a23580be0fcd69ac3a98b5ff01c..ecc1e950ca3ad4ac4d95e4753e6ef3c4ac33d367 100644 --- a/journals/models.py +++ b/journals/models.py @@ -126,8 +126,13 @@ class Issue(models.Model): def __str__(self): text = str(self.in_volume) + ' issue ' + str(self.number) - if self.until_date >= timezone.now().date(): - text += ' (in progress)' + #if self.until_date >= timezone.now().date(): + # text += ' (in progress)' + if self.start_date.month == self.until_date.month: + text += ' (' + self.until_date.strftime('%B') + ' ' + self.until_date.strftime('%Y') + ')' + else: + text += (' (' + self.start_date.strftime('%B') + '-' + self.until_date.strftime('%B') + + ' ' + self.until_date.strftime('%Y') + ')') return text def period (self): diff --git a/journals/templates/journals/scipost_physics.html b/journals/templates/journals/scipost_physics.html index 6f589a50ba978e19fae9927dcc9c608dd9ec7703..5370b7d6600f6a8410b3803ada12f8e740a17de0 100644 --- a/journals/templates/journals/scipost_physics.html +++ b/journals/templates/journals/scipost_physics.html @@ -70,23 +70,45 @@ {% include 'journals/scipost_physics_menu.html' %} + {% if current_issue %} <div class="flex-container"> <div class="flex-greybox"> - <h2>Current issue: Vol. {{ latest_issue.in_volume.number }} issue {{ latest_issue.number }} (in progress)</h2> + <h2>Current issue: Vol. {{ current_issue.in_volume.number }} issue {{ current_issue.number }} (in progress)</h2> </div> </div> <div class="flex-container"> - {% if recent_papers %} <div class="flex-whitebox800"> <ul class="publicationHeaderList"> - {% for paper in recent_papers %} + {% for paper in current_issue.publication_set.all|dictsort:"paper_nr" %} + {{ paper.header_as_li }} + {% endfor %} + </ul> + </div> + </div> + <hr class="hr12"/> + {% endif %} + + {% if latest_issue %} + <div class="flex-container"> + <div class="flex-greybox"> + <h2>Latest issue: Vol. {{ latest_issue.in_volume.number }} issue {{ latest_issue.number }}</h2> + </div> + </div> + + <div class="flex-container"> + {% if latest_issue %} + <div class="flex-whitebox800"> + <ul class="publicationHeaderList"> + {% for paper in latest_issue.publication_set.all|dictsort:"paper_nr" %} {{ paper.header_as_li }} {% endfor %} </ul> {% endif %} </div> </div> + {% endif %} + </section> diff --git a/journals/templates/journals/scipost_physics_recent.html b/journals/templates/journals/scipost_physics_recent.html index cee2759e59c604a3f316a82f229ee5f7d798685b..49a169cc9599e686b213315c0e2e94c6a119952d 100644 --- a/journals/templates/journals/scipost_physics_recent.html +++ b/journals/templates/journals/scipost_physics_recent.html @@ -24,7 +24,7 @@ <div class="flex-container"> <div class="flex-greybox"> - <h2>{{ latest_issue }}</h2> + <h2>Recent publications:</h2> </div> </div> diff --git a/journals/views.py b/journals/views.py index 9161d8cb9a3c611ebed5e86510eb9991176e8e31..4cf04ef254376b90c33b41fd32e1f98fd473e82e 100644 --- a/journals/views.py +++ b/journals/views.py @@ -58,10 +58,16 @@ def journals(request): def scipost_physics(request): #issues = Issue.objects.filter( # in_volume__in_journal__name='SciPost Physics').order_by('-until_date') + current_issue = Issue.objects.filter( + in_volume__in_journal__name='SciPost Physics', + start_date__lte=timezone.now(), + until_date__gte=timezone.now()).order_by('-until_date').first() latest_issue = Issue.objects.filter( - in_volume__in_journal__name='SciPost Physics').order_by('-until_date').first() - recent_papers = Publication.objects.filter( - in_issue=latest_issue).order_by('paper_nr') + in_volume__in_journal__name='SciPost Physics', + until_date__lte=timezone.now()).order_by('-until_date').first() + #recent_papers = Publication.objects.filter( + # #in_issue=latest_issue).order_by('paper_nr') + # in_issue__in_volume__in_journal__name='SciPost Physics').order_by('-publication_date')[:20] #accepted_SP_submissions = Submission.objects.filter( # submitted_to_journal='SciPost Physics', status='accepted' #).order_by('-latest_activity') @@ -69,11 +75,13 @@ def scipost_physics(request): # submitted_to_journal='SciPost Physics' # ).exclude(status__in=SUBMISSION_STATUS_PUBLICLY_UNLISTED # ).order_by('-submission_date') - context = {#'issues': issues, - 'latest_issue': latest_issue, - 'recent_papers': recent_papers, - #'accepted_SP_submissions': accepted_SP_submissions, - #'current_SP_submissions': current_SP_submissions, + context = { + #'issues': issues, + 'current_issue': current_issue, + 'latest_issue': latest_issue, + #'recent_papers': recent_papers, + #'accepted_SP_submissions': accepted_SP_submissions, + #'current_SP_submissions': current_SP_submissions, } return render(request, 'journals/scipost_physics.html', context) @@ -81,21 +89,20 @@ def scipost_physics(request): def scipost_physics_issues(request): issues = Issue.objects.filter( in_volume__in_journal__name='SciPost Physics').order_by('-until_date') - latest_issue = issues.first() context = {'issues': issues,} return render(request, 'journals/scipost_physics_issues.html', context) def scipost_physics_recent(request): """ - Display page for publications in SciPost Physics which - are part of the current issue. + Display page for the most recent 20 publications in SciPost Physics. """ - latest_issue = Issue.objects.filter( - in_volume__in_journal__name='SciPost Physics').order_by('-until_date').first() + #latest_issue = Issue.objects.filter( + # in_volume__in_journal__name='SciPost Physics').order_by('-until_date').first() recent_papers = Publication.objects.filter( - in_issue=latest_issue).order_by('-publication_date') - context = {'latest_issue': latest_issue, + #in_issue=latest_issue).order_by('-publication_date') + in_issue__in_volume__in_journal__name='SciPost Physics').order_by('-publication_date')[:20] + context = {#'latest_issue': latest_issue, 'recent_papers': recent_papers} return render(request, 'journals/scipost_physics_recent.html', context)