2017-09-22 15:15:05 +02:00
|
|
|
""" Context processors """
|
|
|
|
|
|
|
|
from . import models
|
|
|
|
|
|
|
|
|
|
|
|
def sidebar_years(req):
|
|
|
|
avail_years = models.PublicationYear.objects.all()
|
2017-09-24 19:10:20 +02:00
|
|
|
publi_years = [year for year in avail_years if year.publis().count() > 0]
|
2017-09-22 19:03:43 +02:00
|
|
|
|
|
|
|
num_special_publications = models.Publication.objects\
|
|
|
|
.filter(is_special=True).count()
|
|
|
|
|
2017-09-22 15:15:05 +02:00
|
|
|
return {
|
|
|
|
'publication_years': publi_years,
|
2017-09-22 19:03:43 +02:00
|
|
|
'has_special_publications': num_special_publications > 0,
|
2017-09-22 15:15:05 +02:00
|
|
|
}
|