Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4718 - Fixes broken Kudos API #4749

Merged
merged 7 commits into from
Aug 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/kudos/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TokenSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Token
fields = ('id', 'created_on', 'modified_on', 'name', 'description', 'image', 'rarity',
'price', 'num_clones_allowed', 'num_clones_in_wild', 'owner_address', 'tags')
'price_finney', 'num_clones_allowed', 'num_clones_in_wild', 'owner_address', 'tags')


class WalletSerializer(serializers.HyperlinkedModelSerializer):
Expand Down Expand Up @@ -65,7 +65,7 @@ class TokenViewSet(viewsets.ModelViewSet):
queryset = Token.objects.all().order_by('-id')
serializer_class = TokenSerializer
filter_backends = (django_filters.rest_framework.DjangoFilterBackend,)
# filter_fields = ('name', 'description', 'image', 'rarity', 'price', 'num_clones_allowed',
# filter_fields = ('name', 'description', 'image', 'rarity', 'price_finney', 'num_clones_allowed',
# 'num_clones_in_wild', 'owner_address', 'tags')

def get_queryset(self):
Expand All @@ -85,8 +85,8 @@ def get_queryset(self):
queryset = queryset.filter(rarity__iexact=self.request.query_params.get('rarity'))

# Filter by price
if 'price' in param_keys:
queryset = queryset.filter(price__iexact=self.request.query_params.get('price'))
if 'price_finney' in param_keys:
queryset = queryset.filter(price_finney__iexact=self.request.query_params.get('price_finney'))

# Filter by num_clones_allowed
if 'num_clones_allowed' in param_keys:
Expand Down