-
-
Notifications
You must be signed in to change notification settings - Fork 775
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
59 additions
and
0 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 |
---|---|---|
|
@@ -111,6 +111,7 @@ | |
'retail', | ||
'ptokens', | ||
'rest_framework', | ||
'django_filters', | ||
'marketing', | ||
'economy', | ||
'dashboard', | ||
|
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,39 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Define dashboard specific DRF API routes. | ||
Copyright (C) 2021 Gitcoin Core | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
""" | ||
from quadraticlands.serializer import GTCStewardSerializer | ||
from rest_framework import routers, viewsets | ||
from rest_framework.pagination import PageNumberPagination | ||
|
||
from .models import GTCSteward | ||
|
||
|
||
class GTCStewardPagination(PageNumberPagination): | ||
page_size = 30 | ||
page_size_query_param = 'page_size' | ||
|
||
|
||
class GTCStewardViewSet(viewsets.ModelViewSet): | ||
queryset = GTCSteward.objects.all() | ||
serializer_class = GTCStewardSerializer | ||
pagination_class = GTCStewardPagination | ||
|
||
|
||
router = routers.DefaultRouter() | ||
router.register(r'stewards', GTCStewardViewSet) |
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,15 @@ | ||
from dashboard.models import ProfileSerializer | ||
from rest_flex_fields import FlexFieldsModelSerializer | ||
|
||
from .models import GTCSteward | ||
|
||
|
||
class GTCStewardSerializer(FlexFieldsModelSerializer): | ||
"""Handle serializing of GTCSteward""" | ||
class Meta: | ||
"""Define the GrantCLR serializer metadata.""" | ||
model = GTCSteward | ||
fields = ('profile', 'real_name', 'bio', 'gtc_address', 'profile_link', 'custom_steward_img') | ||
expandable_fields = { | ||
'profile': ProfileSerializer | ||
} |
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 |
---|---|---|
|
@@ -116,3 +116,4 @@ libsass==0.20.1 | |
graphqlclient==0.2.4 | ||
docutils==0.17.1 | ||
unidecode==1.2.0 | ||
drf-flex-fields==0.9.1 |