Skip to content

Commit

Permalink
[Fixes #166788402 ] Fix rating of users (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipotieno authored and koechkevin committed Jun 20, 2019
1 parent 81403c9 commit 46884a8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
9 changes: 1 addition & 8 deletions authors/apps/articles/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,8 @@ def ratings(self, article, user):
Model to display rating for users in an articles
"""

try:
article = self.article
user = self.rated_by
except Article.DoesNotExist:
pass

queryset = RatingModel.objects.filter(
article_id=article, rated_by_id=user).first()

article_id=article).first()
if queryset:
return {
"my_ratings": queryset.rate,
Expand Down
19 changes: 19 additions & 0 deletions authors/apps/profiles/migrations/0002_auto_20190620_0920.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2 on 2019-06-20 09:20

import cloudinary.models
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('profiles', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='profile',
name='image',
field=cloudinary.models.CloudinaryField(default='https://res.cloudinary.com/grean/image/upload/v1560445304/default_ddfimn.png', max_length=255, verbose_name='image'),
),
]

0 comments on commit 46884a8

Please sign in to comment.