I don't know but this is the current state
This commit is contained in:
1 parent
3fff0bcf0d
commit
c57a52e075
7 files changed
+86
-4
No files matched your search
@@ -61,7 +61,7 @@ class Command(BaseCommand):
|
||||
self.echo(f"- relevant: {len(publications_relevant):4d}", bold=True)
|
||||
|
||||
pubs = Publication.objects.values('title').annotate(count=Count('referenced_by')).values('title', 'year', 'count').order_by('count').reverse()
|
||||
for p in pubs[:15]: print(f"{p['title']} ({p['year']}): {p['count']} citations")
|
||||
for p in pubs[:50]: print(f"{p['title']} ({p['year']}): {p['count']} citations")
|
||||
|
||||
years = Publication.objects.values('year').annotate(count=Count('year')).values('year', 'count')
|
||||
for y in years: print(f"{y['year']}, {y['count']}")
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
li a {
|
||||
color: green;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<!doctype html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Tagging publications</title>
|
||||
</head>
|
||||
<body>
|
||||
{% if publication %}
|
||||
{% for author in publication.authors.all %}
|
||||
<a>{{ author.name }}, </a>
|
||||
{% endfor %}
|
||||
<h2>{{ publication.title }} ({{ publication.year }})</h2>
|
||||
{% if publication.doi %}
|
||||
<!-- atm this is a link under /tag as well! -->
|
||||
<a href="https://doi.org/{{ publication.doi }}">{{ publication.doi }}</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<p>No publications are available.</p>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,21 @@
|
||||
<!doctype html>
|
||||
{% load static %}
|
||||
|
||||
<link rel="stylesheet" href="{% static 'tag/style.css' %}">
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>List for tagging publications</title>
|
||||
</head>
|
||||
<body>
|
||||
{% if newest_publications %}
|
||||
<ul>
|
||||
{% for publication in newest_publications %}
|
||||
<li><a href="{% url 'detail' publication.cite_key %}/">{{ publication.title }}, {{publication.year}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>No publications are available.</p>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,8 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.IndexView.as_view(), name="index"),
|
||||
path("<path:cite_key>", views.detail, name="detail"),
|
||||
]
|
||||
+30
-2
@@ -1,3 +1,31 @@
|
||||
from django.shortcuts import render
|
||||
from django.db.models import F
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.urls import reverse
|
||||
from django.views import generic
|
||||
|
||||
from sok.models import Publication, PublicationReference
|
||||
|
||||
|
||||
class IndexView(generic.ListView):
|
||||
template_name = "tag/index.html"
|
||||
context_object_name = "newest_publications"
|
||||
|
||||
def get_queryset(self):
|
||||
return Publication.objects.order_by("-year")[:10]
|
||||
|
||||
def detail(request, cite_key):
|
||||
try:
|
||||
publication = get_object_or_404(Publication, cite_key=cite_key.strip('/'))
|
||||
except Publication.DoesNotExist:
|
||||
raise Http404("Publication does not exist")
|
||||
return render(request, "tag/detail.html", {"publication": publication})
|
||||
|
||||
|
||||
# def overview(request):
|
||||
# try:
|
||||
# ps = Publication.objects.get(...)
|
||||
# except Publication.DoesNotExist:
|
||||
# raise Http404("Publication does not exist")
|
||||
# return render(request, "publications/overview.html", {"to_tag": ps})
|
||||
|
||||
# Create your views here.
|
||||
Reference in new issue
Block a user