Skip to content

Commit

Permalink
Merge branch 'master' of github.com:GeoNode/geonode
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Garcia Silva committed Jul 29, 2021
2 parents 5a65e39 + d605bcd commit dd6073e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion geonode/base/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import json
from urllib.parse import urljoin

from django.conf import settings
from django.contrib.auth.models import Group
from django.contrib.auth import get_user_model
from django.forms.models import model_to_dict
Expand Down Expand Up @@ -375,7 +376,7 @@ def to_representation(self, instance):
data['perms'] = instance.get_user_perms(request.user).union(
instance.get_self_resource().get_user_perms(request.user)
)
if not request.user.is_anonymous:
if not request.user.is_anonymous and getattr(settings, "FAVORITE_ENABLED", False):
favorite = Favorite.objects.filter(user=request.user, object_id=instance.pk).count()
data['favorite'] = favorite > 0
# Adding links to resource_base api
Expand Down

0 comments on commit dd6073e

Please sign in to comment.