Skip to content

Commit

Permalink
Depth
Browse files Browse the repository at this point in the history
  • Loading branch information
ankurr0y committed Nov 8, 2023
1 parent a61ab36 commit 4645bde
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
6 changes: 6 additions & 0 deletions src/involvement/serializers/position_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ class PositionSerializer(serializers.ModelSerializer):
class Meta:
model = Position
fields = '__all__'

class PositionDepthSerializer(serializers.ModelSerializer):
class Meta:
model = Position
fields = '__all__'
depth = 1
1 change: 1 addition & 0 deletions src/involvement/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

router = routers.SimpleRouter()
router.register(r'^position', views.position_api.PositionViewSet, basename="PositionView")
router.register(r'^position2', views.position_api.Position2ViewSet, basename="Position2View")

urlpatterns = [
re_path(
Expand Down
6 changes: 5 additions & 1 deletion src/involvement/views/position_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from rest_framework import viewsets
from involvement.serializers.position_serializer import PositionSerializer
from involvement.serializers.position_serializer import PositionSerializer, PositionDepthSerializer
from rest_framework.permissions import AllowAny
from involvement.models.position import Position

Expand All @@ -8,3 +8,7 @@ class PositionViewSet(viewsets.ModelViewSet):
permission_classes = [AllowAny]
queryset = Position.objects.all()

class Position2ViewSet(viewsets.ModelViewSet):
serializer_class = PositionDepthSerializer
permission_classes = [AllowAny]
queryset = Position.objects.all()
40 changes: 20 additions & 20 deletions src/moore/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases


if IS_RUNNING_TEST:
DATABASES = {
# if IS_RUNNING_TEST:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Override search backend to not use postgres
WAGTAILSEARCH_BACKENDS = {
'default': {
'BACKEND': 'wagtail.search.backends.database',
}
}

elif 'DOCKER' in os.environ:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'moore',
'USER': 'moore',
'HOST': 'moore-db',
'PASSWORD': 'moore',
'PORT': 5432,
}
}
# # Override search backend to not use postgres
# WAGTAILSEARCH_BACKENDS = {
# 'default': {
# 'BACKEND': 'wagtail.search.backends.database',
# }
# }

# elif 'DOCKER' in os.environ:
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql',
# 'NAME': 'moore',
# 'USER': 'moore',
# 'HOST': 'moore-db',
# 'PASSWORD': 'moore',
# 'PORT': 5432,
# }
# }

# Base URL to use when referring to full URLs within the Wagtail admin
# backend - e.g. in notification emails. Don't include '/admin' or a
Expand Down

0 comments on commit 4645bde

Please sign in to comment.