Приложение голосование сделано!
This commit is contained in:
1 parent
e3661db5cb
commit
2108058a6b
5 files changed
+83
-26
No files matched your search
@@ -11,7 +11,6 @@ class ThanksVote(models.Model):
|
||||
vote_thanks_date = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
class Meta:
|
||||
# unique_together = ('cand_name', 'voted_user')
|
||||
verbose_name = "Голосование, хочу сказать спасибо!"
|
||||
verbose_name_plural = "Голосование, хочу сказать спасибо!"
|
||||
|
||||
@@ -27,7 +26,6 @@ class BestVote(models.Model):
|
||||
vote_best_date = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
class Meta:
|
||||
# unique_together = ('cand_name', 'voted_user')
|
||||
verbose_name = "Голосование, мой коллега самый лучший"
|
||||
verbose_name_plural = "Голосование, мой коллега самый лучший"
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ class SetThanks(APIView):
|
||||
class GetThanks(APIView):
|
||||
def get(self, request):
|
||||
# Группировка кандидатов по имени и подсчет каждого
|
||||
count_thanks = ThanksVote.objects.values(
|
||||
'cand_name').annotate(total=Count('id'))
|
||||
count_thanks = ThanksVote.objects.values('voted_user',
|
||||
'cand_name').annotate(total=Count('id'))
|
||||
return Response(count_thanks)
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ class SetBest(APIView):
|
||||
class GetBest(APIView):
|
||||
def get(self, request):
|
||||
# Группировка кандидатов по имени и подсчет каждого
|
||||
count_bests = BestVote.objects.values(
|
||||
'department_user', 'cand_name').annotate(total=Count('id'))
|
||||
count_bests = BestVote.objects.values('voted_user',
|
||||
'department_user', 'cand_name').annotate(total=Count('id'))
|
||||
return Response(count_bests)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user