-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from UnitapApp/develop
Develop
- Loading branch information
Showing
23 changed files
with
1,683 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from rest_framework import filters | ||
from rest_framework.generics import get_object_or_404 | ||
|
||
from faucet.models import Chain | ||
|
||
|
||
class IsOwnerFilterBackend(filters.BaseFilterBackend): | ||
""" | ||
Filter that only allows users to see their own objects. | ||
""" | ||
|
||
def filter_queryset(self, request, queryset, view): | ||
return queryset.filter(user_profile=request.user.profile) | ||
|
||
|
||
class ChainFilterBackend(filters.BaseFilterBackend): | ||
""" | ||
Filter that filter nested chains | ||
""" | ||
|
||
def filter_queryset(self, request, queryset, view): | ||
chain_pk = request.query_params.get('chain_pk') | ||
if chain_pk is None: | ||
return queryset | ||
return queryset.filter(chain=get_object_or_404(Chain, pk=chain_pk)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.0.4 on 2023-09-15 10:34 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='tokenprice', | ||
name='price_url', | ||
field=models.URLField(max_length=255, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rest_framework.pagination import PageNumberPagination | ||
|
||
|
||
class StandardResultsSetPagination(PageNumberPagination): | ||
page_size = 100 | ||
page_size_query_param = 'page_size' | ||
max_page_size = 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.