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
|
|
|
|
2024-10-23 11:06:57 +02:00
|
|
|
num_special_publications = models.Publication.objects.filter(
|
|
|
|
is_special=True
|
|
|
|
).count()
|
2017-09-22 19:03:43 +02:00
|
|
|
|
2017-09-22 15:15:05 +02:00
|
|
|
return {
|
2024-10-23 11:06:57 +02:00
|
|
|
"publication_years": publi_years,
|
|
|
|
"has_special_publications": num_special_publications > 0,
|
2017-09-22 15:15:05 +02:00
|
|
|
}
|