Skip to content
Snippets Groups Projects

Fix front page stats

Merged Samuel GAIST requested to merge 514_fix_front_page_stats into django3_migration
1 file
+ 12
0
Compare changes
  • Side-by-side
  • Inline
@@ -31,6 +31,7 @@ from datetime import timedelta
from django.conf import settings
from django.db import models
from django.db.models import Q
from django.urls import reverse
from ..algorithms.models import Algorithm
@@ -75,6 +76,17 @@ class AttestationManager(models.Manager):
def published(self):
return self.filter(locked=False)
def for_user(self, user, add_public=False):
if user.is_anonymous:
return self.published()
query = Q(experiment__author=user)
if add_public:
query |= Q(locked=False)
return self.filter(query).distinct()
class Attestation(models.Model):
Loading