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

added viewsets #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Binary file modified CCD/__pycache__/settings.cpython-37.pyc
Binary file not shown.
Binary file modified CCD/__pycache__/urls.cpython-37.pyc
Binary file not shown.
Binary file added CCD/__pycache__/wsgi.cpython-37.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions CCD/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'drf_spectacular',
'rest_framework',
'HotelsCabs',
'facilities',
'reachingIITG',
Expand Down
12 changes: 12 additions & 0 deletions CCD/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
SpectacularSwaggerView,
)

from django.urls import include, path
from rest_framework import routers
from faq import views
from policies import views as viewss

router = routers.DefaultRouter()
""" router.register(r'Placement_policy', viewss.Placement_Policy_ViewSet) """
router.register(r'Policies', viewss.Policy_ViewSet)
router.register(r'FAQ', views.FaqViewSet)

app_name="home"
urlpatterns = [
# YOUR PATTERNS
Expand All @@ -22,4 +32,6 @@
name="redoc",
),
path('admin/', admin.site.urls),
path('', include(router.urls)),
path('api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]
Binary file added contactus/__pycache__/views.cpython-37.pyc
Binary file not shown.
Binary file added faq/__pycache__/serializers.cpython-37.pyc
Binary file not shown.
Binary file added faq/__pycache__/views.cpython-37.pyc
Binary file not shown.
8 changes: 8 additions & 0 deletions faq/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from .models import FAQ
from rest_framework import serializers

class FaqSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = FAQ
fields = '__all__'

11 changes: 11 additions & 0 deletions faq/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
from django.shortcuts import render

from .models import FAQ
from rest_framework import viewsets
from rest_framework import permissions
from .serializers import FaqSerializer

# Create your views here.

class FaqViewSet(viewsets.ModelViewSet):

queryset = FAQ.objects.all()
serializer_class = FaqSerializer
# permission_classes = [permissions.IsAuthenticated]
Binary file added policies/__pycache__/serializers.cpython-37.pyc
Binary file not shown.
Binary file added policies/__pycache__/views.cpython-37.pyc
Binary file not shown.
12 changes: 12 additions & 0 deletions policies/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from .models import Policy
from rest_framework import serializers

class Policy_Serializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Policy
fields = '__all__'

""" class Placement_Policy_Serializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Policy
fields = '__all__' """
17 changes: 17 additions & 0 deletions policies/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
from django.shortcuts import render

from .models import Policy
from rest_framework import viewsets
from rest_framework import permissions
from .serializers import Policy_Serializer

# Create your views here.

class Policy_ViewSet(viewsets.ModelViewSet):

queryset = Policy.objects.all()
serializer_class = Policy_Serializer
# permission_classes = [permissions.IsAuthenticated]

""" class Placement_Policy_ViewSet(viewsets.ModelViewSet):

queryset = Policy.objects.all()
serializer_class = Placement_Policy_Serializer
# permission_classes = [permissions.IsAuthenticated] """