-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add endpoint for reading enviromental_justice data
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 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,26 @@ | ||
from rest_framework import serializers | ||
|
||
from .models import EnvironmentalJusticeRow | ||
|
||
|
||
class EnvironmentalJusticeRowSerializer(serializers.HyperlinkedModelSerializer): | ||
class Meta: | ||
model = EnvironmentalJusticeRow | ||
fields = [ | ||
"dataset", | ||
"description", | ||
"description_simplified", | ||
"indicators", | ||
"intended_use", | ||
"latency", | ||
"limitations", | ||
"project", | ||
"source_link", | ||
"strengths", | ||
"format", | ||
"geographic_coverage", | ||
"data_visualization", | ||
"spatial_resolution", | ||
"temporal_extent", | ||
"temporal_resolution", | ||
] |
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 |
---|---|---|
@@ -1,3 +1,17 @@ | ||
from django.shortcuts import render # noqa | ||
from rest_framework import permissions, viewsets | ||
|
||
# Create your views here. | ||
from .models import EnvironmentalJusticeRow | ||
from .serializers import EnvironmentalJusticeRowSerializer | ||
|
||
|
||
class EnvironmentalJusticeRowViewSet(viewsets.ModelViewSet): | ||
""" | ||
API endpoint that allows environmental justice rows to be read. | ||
""" | ||
|
||
queryset = EnvironmentalJusticeRow.objects.all() | ||
serializer_class = EnvironmentalJusticeRowSerializer | ||
permission_classes = [permissions.IsAuthenticated] | ||
http_method_names = [ | ||
"get", | ||
] |
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