Commit 7159c6ea authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Add view to get timezone options

parent d13de02d
......@@ -14,6 +14,7 @@ from .views import (
CourseAuthorViewSet,
CoursePictureUploadViewSet,
TranslateSlugView,
TimezonesView,
)
from .videos.views import VideoViewSet
from .course_material.views import CourseMaterialViewSet, CourseMaterialFileViewSet
......@@ -48,7 +49,6 @@ from courses.notes.views import (
NotesViewSet,
UserNotesViewSet,
)
from courses.certification.views import (
CourseCertificationPDFView,
)
......@@ -111,6 +111,8 @@ urlpatterns = [
url(r'^user-access', UserAccessView.as_view(), name='user-access'),
url(r'^translate-slug', TranslateSlugView.as_view(), name='translate-slug'),
url(r'^timezones', TimezonesView.as_view(), name='timezones'),
url(r'^certificate/(?P<slug>[-a-zA-Z0-9_]+)/pdf/$',
CourseCertificationPDFView.as_view(template_name="certificate_pdf.html"),
name='certificate-pdf',
......
from django.db.models import Q
from django.db import IntegrityError
from django.contrib.auth import get_user_model
from django.http import HttpResponse
from rest_framework import views, viewsets, mixins, permissions, status
from rest_framework.response import Response
......@@ -335,3 +336,13 @@ class TranslateSlugView(views.APIView):
return Response({'slug': translated_slug}, status=status.HTTP_200_OK)
class TimezonesView(views.APIView):
permission_classes = [permissions.IsAuthenticated]
def get(self, request, *args, **kwargs):
import pytz
import json
timezones = json.dumps({"timezones": pytz.common_timezones})
return HttpResponse(timezones, content_type ="application/json")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment