|
|
|
@ -8,7 +8,7 @@ from django.db import models
|
|
|
|
|
from django.db.models import Q, Count, Avg, Case, When
|
|
|
|
|
from django.db.models.functions import Coalesce
|
|
|
|
|
from django.utils import timezone
|
|
|
|
|
from django.utils.translation import ugettext, ugettext_lazy as _
|
|
|
|
|
from django.utils.translation import gettext, gettext_lazy as _
|
|
|
|
|
from django.utils.safestring import mark_safe
|
|
|
|
|
from django.utils.html import escape, format_html
|
|
|
|
|
|
|
|
|
@ -281,7 +281,7 @@ class TalkCategory(models.Model): # type of talk (conf 30min, 1h, stand, …)
|
|
|
|
|
verbose_name_plural = "categories"
|
|
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
|
return ugettext(self.name)
|
|
|
|
|
return gettext(self.name)
|
|
|
|
|
|
|
|
|
|
def get_absolute_url(self):
|
|
|
|
|
return reverse('category-list')
|
|
|
|
@ -317,7 +317,7 @@ class TalkCategory(models.Model): # type of talk (conf 30min, 1h, stand, …)
|
|
|
|
|
class TalkManager(models.Manager):
|
|
|
|
|
def get_queryset(self):
|
|
|
|
|
qs = super().get_queryset()
|
|
|
|
|
qs = qs.annotate(score=Coalesce(Avg('vote__vote'), 0))
|
|
|
|
|
qs = qs.annotate(score=Coalesce(Avg('vote__vote'), 0.0))
|
|
|
|
|
return qs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|