Merge pull request #1456 from normanjaeckel/fix1450

Updated ViewSets to Django REST Framework 3.0.5.
This commit is contained in:
Oskar Hahn 2015-02-12 21:10:13 +01:00
commit 48c4f8dcf5
15 changed files with 74 additions and 74 deletions

View File

@ -1,11 +1,11 @@
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from openslides.utils.rest_api import get_collection_and_id_from_url, serializers from openslides.utils.rest_api import CharField, ModelSerializer, RelatedField, get_collection_and_id_from_url
from .models import Item, Speaker from .models import Item, Speaker
class SpeakerSerializer(serializers.ModelSerializer): class SpeakerSerializer(ModelSerializer):
""" """
Serializer for agenda.models.Speaker objects. Serializer for agenda.models.Speaker objects.
""" """
@ -19,7 +19,7 @@ class SpeakerSerializer(serializers.ModelSerializer):
'weight') 'weight')
class RelatedItemRelatedField(serializers.RelatedField): class RelatedItemRelatedField(RelatedField):
""" """
A custom field to use for the content_object generic relationship. A custom field to use for the content_object generic relationship.
""" """
@ -34,14 +34,14 @@ class RelatedItemRelatedField(serializers.RelatedField):
return {'collection': collection, 'id': obj_id} return {'collection': collection, 'id': obj_id}
class ItemSerializer(serializers.ModelSerializer): class ItemSerializer(ModelSerializer):
""" """
Serializer for agenda.models.Item objects. Serializer for agenda.models.Item objects.
""" """
get_title = serializers.CharField(read_only=True) get_title = CharField(read_only=True)
get_title_supplement = serializers.CharField(read_only=True) get_title_supplement = CharField(read_only=True)
content_object = RelatedItemRelatedField(read_only=True) content_object = RelatedItemRelatedField(read_only=True)
item_no = serializers.CharField(read_only=True) item_no = CharField(read_only=True)
speaker_set = SpeakerSerializer(many=True, read_only=True) speaker_set = SpeakerSerializer(many=True, read_only=True)
class Meta: class Meta:

View File

@ -25,7 +25,7 @@ from openslides.projector.api import (
get_overlays) get_overlays)
from openslides.utils.exceptions import OpenSlidesError from openslides.utils.exceptions import OpenSlidesError
from openslides.utils.pdf import stylesheet from openslides.utils.pdf import stylesheet
from openslides.utils.rest_api import viewsets from openslides.utils.rest_api import ModelViewSet
from openslides.utils.utils import html_strong from openslides.utils.utils import html_strong
from openslides.utils.views import ( from openslides.utils.views import (
AjaxMixin, AjaxMixin,
@ -775,11 +775,11 @@ class ItemCSVImportView(CSVImportView):
template_name = 'agenda/item_form_csv_import.html' template_name = 'agenda/item_form_csv_import.html'
class ItemViewSet(viewsets.ModelViewSet): class ItemViewSet(ModelViewSet):
""" """
API endpoint to list, retrieve, create, update and destroy agenda items. API endpoint to list, retrieve, create, update and destroy agenda items.
""" """
model = Item queryset = Item.objects.all()
serializer_class = ItemSerializer serializer_class = ItemSerializer
def check_permissions(self, request): def check_permissions(self, request):
@ -807,7 +807,7 @@ class ItemViewSet(viewsets.ModelViewSet):
""" """
Filters organizational items if the user has no permission to see them. Filters organizational items if the user has no permission to see them.
""" """
queryset = Item.objects.all() queryset = super().get_queryset()
if not self.request.user.has_perm('agenda.can_see_orga_items'): if not self.request.user.has_perm('agenda.can_see_orga_items'):
queryset = queryset.exclude(type__exact=Item.ORGANIZATIONAL_ITEM) queryset = queryset.exclude(type__exact=Item.ORGANIZATIONAL_ITEM)
return queryset return queryset

View File

@ -1,4 +1,4 @@
from openslides.utils.rest_api import serializers from openslides.utils.rest_api import ListSerializer, ModelSerializer
from .models import ( from .models import (
models, models,
@ -9,7 +9,7 @@ from .models import (
AssignmentVote) AssignmentVote)
class AssignmentRelatedUserSerializer(serializers.ModelSerializer): class AssignmentRelatedUserSerializer(ModelSerializer):
""" """
Serializer for assignment.models.AssignmentRelatedUser objects. Serializer for assignment.models.AssignmentRelatedUser objects.
""" """
@ -21,7 +21,7 @@ class AssignmentRelatedUserSerializer(serializers.ModelSerializer):
'status') 'status')
class AssignmentVoteSerializer(serializers.ModelSerializer): class AssignmentVoteSerializer(ModelSerializer):
""" """
Serializer for assignment.models.AssignmentVote objects. Serializer for assignment.models.AssignmentVote objects.
""" """
@ -30,7 +30,7 @@ class AssignmentVoteSerializer(serializers.ModelSerializer):
fields = ('weight', 'value',) fields = ('weight', 'value',)
class AssignmentOptionSerializer(serializers.ModelSerializer): class AssignmentOptionSerializer(ModelSerializer):
""" """
Serializer for assignment.models.AssignmentOption objects. Serializer for assignment.models.AssignmentOption objects.
""" """
@ -41,7 +41,7 @@ class AssignmentOptionSerializer(serializers.ModelSerializer):
fields = ('candidate', 'assignmentvote_set',) fields = ('candidate', 'assignmentvote_set',)
class FilterPollListSerializer(serializers.ListSerializer): class FilterPollListSerializer(ListSerializer):
""" """
Customized serializer to filter polls (exclude unpublished). Customized serializer to filter polls (exclude unpublished).
""" """
@ -57,7 +57,7 @@ class FilterPollListSerializer(serializers.ListSerializer):
return [self.child.to_representation(item) for item in iterable] return [self.child.to_representation(item) for item in iterable]
class AssignmentAllPollSerializer(serializers.ModelSerializer): class AssignmentAllPollSerializer(ModelSerializer):
""" """
Serializer for assignment.models.AssignmentPoll objects. Serializer for assignment.models.AssignmentPoll objects.
@ -98,7 +98,7 @@ class AssignmentShortPollSerializer(AssignmentAllPollSerializer):
'votescast',) 'votescast',)
class AssignmentFullSerializer(serializers.ModelSerializer): class AssignmentFullSerializer(ModelSerializer):
""" """
Serializer for assignment.models.Assignment objects. With all polls. Serializer for assignment.models.Assignment objects. With all polls.
""" """

View File

@ -14,7 +14,7 @@ from openslides.config.api import config
from openslides.users.models import Group, User # TODO: remove this from openslides.users.models import Group, User # TODO: remove this
from openslides.poll.views import PollFormView from openslides.poll.views import PollFormView
from openslides.utils.pdf import stylesheet from openslides.utils.pdf import stylesheet
from openslides.utils.rest_api import viewsets from openslides.utils.rest_api import ModelViewSet
from openslides.utils.utils import html_strong from openslides.utils.utils import html_strong
from openslides.utils.views import (CreateView, DeleteView, DetailView, from openslides.utils.views import (CreateView, DeleteView, DetailView,
ListView, PDFView, ListView, PDFView,
@ -215,11 +215,10 @@ class AssignmentDeleteCandidateshipOtherView(SingleObjectMixin, QuestionView):
return _("Candidate %s was withdrawn successfully.") % html_strong(self.user) return _("Candidate %s was withdrawn successfully.") % html_strong(self.user)
class AssignmentViewSet(viewsets.ModelViewSet): class AssignmentViewSet(ModelViewSet):
""" """
API endpoint to list, retrieve, create, update and destroy assignments. API endpoint to list, retrieve, create, update and destroy assignments.
""" """
model = Assignment
queryset = Assignment.objects.all() queryset = Assignment.objects.all()
def check_permissions(self, request): def check_permissions(self, request):

View File

@ -4,7 +4,7 @@ from django.core.urlresolvers import reverse
from django.http import Http404 from django.http import Http404
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from openslides.utils.rest_api import response, viewsets from openslides.utils.rest_api import Response, ViewSet
from openslides.utils.views import FormView from openslides.utils.views import FormView
from .api import config from .api import config
@ -105,7 +105,7 @@ class ConfigView(FormView):
return super(ConfigView, self).form_valid(form) return super(ConfigView, self).form_valid(form)
class ConfigViewSet(viewsets.ViewSet): class ConfigViewSet(ViewSet):
""" """
API endpoint to list, retrieve and update the config. API endpoint to list, retrieve and update the config.
""" """
@ -115,7 +115,7 @@ class ConfigViewSet(viewsets.ViewSet):
""" """
# TODO: Check if we need permission check here. # TODO: Check if we need permission check here.
data = ({'key': key, 'value': value} for key, value in config.items()) data = ({'key': key, 'value': value} for key, value in config.items())
return response.Response(data) return Response(data)
def retrieve(self, request, *args, **kwargs): def retrieve(self, request, *args, **kwargs):
""" """
@ -127,7 +127,7 @@ class ConfigViewSet(viewsets.ViewSet):
data = {'key': key, 'value': config[key]} data = {'key': key, 'value': config[key]}
except ConfigNotFound: except ConfigNotFound:
raise Http404 raise Http404
return response.Response(data) return Response(data)
def update(self, request, pk=None): def update(self, request, pk=None):
""" """

View File

@ -1,9 +1,9 @@
from openslides.utils.rest_api import serializers from openslides.utils.rest_api import ModelSerializer
from .models import CustomSlide, Tag from .models import CustomSlide, Tag
class CustomSlideSerializer(serializers.ModelSerializer): class CustomSlideSerializer(ModelSerializer):
""" """
Serializer for core.models.CustomSlide objects. Serializer for core.models.CustomSlide objects.
""" """
@ -12,7 +12,7 @@ class CustomSlideSerializer(serializers.ModelSerializer):
fields = ('id', 'title', 'text', 'weight',) fields = ('id', 'title', 'text', 'weight',)
class TagSerializer(serializers.ModelSerializer): class TagSerializer(ModelSerializer):
""" """
Serializer for core.models.Tag objects. Serializer for core.models.Tag objects.
""" """

View File

@ -16,7 +16,7 @@ from openslides import get_git_commit_id, RELEASE
from openslides.config.api import config from openslides.config.api import config
from openslides.utils import views as utils_views from openslides.utils import views as utils_views
from openslides.utils.plugins import get_plugin_description, get_plugin_verbose_name, get_plugin_version from openslides.utils.plugins import get_plugin_description, get_plugin_verbose_name, get_plugin_version
from openslides.utils.rest_api import viewsets from openslides.utils.rest_api import ModelViewSet
from openslides.utils.signals import template_manipulation from openslides.utils.signals import template_manipulation
from openslides.utils.widgets import Widget from openslides.utils.widgets import Widget
@ -235,11 +235,10 @@ class CustomSlideDeleteView(CustomSlideViewMixin, utils_views.DeleteView):
pass pass
class CustomSlideViewSet(viewsets.ModelViewSet): class CustomSlideViewSet(ModelViewSet):
""" """
API endpoint to list, retrieve, create, update and destroy custom slides. API endpoint to list, retrieve, create, update and destroy custom slides.
""" """
model = CustomSlide
queryset = CustomSlide.objects.all() queryset = CustomSlide.objects.all()
serializer_class = CustomSlideSerializer serializer_class = CustomSlideSerializer
@ -330,11 +329,10 @@ class TagListView(utils_views.AjaxMixin, utils_views.ListView):
**context) **context)
class TagViewSet(viewsets.ModelViewSet): class TagViewSet(ModelViewSet):
""" """
API endpoint to list, retrieve, create, update and destroy tags. API endpoint to list, retrieve, create, update and destroy tags.
""" """
model = Tag
queryset = Tag.objects.all() queryset = Tag.objects.all()
serializer_class = TagSerializer serializer_class = TagSerializer

View File

@ -1,13 +1,13 @@
from openslides.utils.rest_api import serializers from openslides.utils.rest_api import ModelSerializer, SerializerMethodField
from .models import Mediafile from .models import Mediafile
class MediafileSerializer(serializers.ModelSerializer): class MediafileSerializer(ModelSerializer):
""" """
Serializer for mediafile.models.Mediafile objects. Serializer for mediafile.models.Mediafile objects.
""" """
filesize = serializers.SerializerMethodField() filesize = SerializerMethodField()
class Meta: class Meta:
model = Mediafile model = Mediafile

View File

@ -2,7 +2,7 @@ from django.http import HttpResponse
from openslides.config.api import config from openslides.config.api import config
from openslides.projector.api import get_active_slide from openslides.projector.api import get_active_slide
from openslides.utils.rest_api import viewsets from openslides.utils.rest_api import ModelViewSet
from openslides.utils.views import (AjaxView, CreateView, DeleteView, RedirectView, ListView, from openslides.utils.views import (AjaxView, CreateView, DeleteView, RedirectView, ListView,
UpdateView) UpdateView)
@ -202,12 +202,11 @@ class PdfToggleFullscreenView(RedirectView):
return {'fullscreen': config['pdf_fullscreen']} return {'fullscreen': config['pdf_fullscreen']}
class MediafileViewSet(viewsets.ModelViewSet): class MediafileViewSet(ModelViewSet):
""" """
API endpoint to list, retrieve, create, update and destroy mediafile API endpoint to list, retrieve, create, update and destroy mediafile
objects. objects.
""" """
model = Mediafile
queryset = Mediafile.objects.all() queryset = Mediafile.objects.all()
serializer_class = MediafileSerializer serializer_class = MediafileSerializer

View File

@ -1,4 +1,4 @@
from openslides.utils.rest_api import serializers from openslides.utils.rest_api import ModelSerializer, PrimaryKeyRelatedField, SerializerMethodField
from .models import ( from .models import (
Category, Category,
@ -14,7 +14,7 @@ from .models import (
Workflow,) Workflow,)
class CategorySerializer(serializers.ModelSerializer): class CategorySerializer(ModelSerializer):
""" """
Serializer for motion.models.Category objects. Serializer for motion.models.Category objects.
""" """
@ -23,7 +23,7 @@ class CategorySerializer(serializers.ModelSerializer):
fields = ('id', 'name', 'prefix',) fields = ('id', 'name', 'prefix',)
class StateSerializer(serializers.ModelSerializer): class StateSerializer(ModelSerializer):
""" """
Serializer for motion.models.State objects. Serializer for motion.models.State objects.
""" """
@ -44,19 +44,19 @@ class StateSerializer(serializers.ModelSerializer):
'next_states',) 'next_states',)
class WorkflowSerializer(serializers.ModelSerializer): class WorkflowSerializer(ModelSerializer):
""" """
Serializer for motion.models.Workflow objects. Serializer for motion.models.Workflow objects.
""" """
state_set = StateSerializer(many=True, read_only=True) state_set = StateSerializer(many=True, read_only=True)
first_state = serializers.PrimaryKeyRelatedField(read_only=True) first_state = PrimaryKeyRelatedField(read_only=True)
class Meta: class Meta:
model = Workflow model = Workflow
fields = ('id', 'name', 'state_set', 'first_state',) fields = ('id', 'name', 'state_set', 'first_state',)
class MotionSubmitterSerializer(serializers.ModelSerializer): class MotionSubmitterSerializer(ModelSerializer):
""" """
Serializer for motion.models.MotionSubmitter objects. Serializer for motion.models.MotionSubmitter objects.
""" """
@ -65,7 +65,7 @@ class MotionSubmitterSerializer(serializers.ModelSerializer):
fields = ('person',) # TODO: Rename this to 'user', see #1348 fields = ('person',) # TODO: Rename this to 'user', see #1348
class MotionSupporterSerializer(serializers.ModelSerializer): class MotionSupporterSerializer(ModelSerializer):
""" """
Serializer for motion.models.MotionSupporter objects. Serializer for motion.models.MotionSupporter objects.
""" """
@ -74,7 +74,7 @@ class MotionSupporterSerializer(serializers.ModelSerializer):
fields = ('person',) # TODO: Rename this to 'user', see #1348 fields = ('person',) # TODO: Rename this to 'user', see #1348
class MotionLogSerializer(serializers.ModelSerializer): class MotionLogSerializer(ModelSerializer):
""" """
Serializer for motion.models.MotionLog objects. Serializer for motion.models.MotionLog objects.
""" """
@ -83,7 +83,7 @@ class MotionLogSerializer(serializers.ModelSerializer):
fields = ('message_list', 'person', 'time',) fields = ('message_list', 'person', 'time',)
class MotionVoteSerializer(serializers.ModelSerializer): class MotionVoteSerializer(ModelSerializer):
""" """
Serializer for motion.models.MotionVote objects. Serializer for motion.models.MotionVote objects.
""" """
@ -92,7 +92,7 @@ class MotionVoteSerializer(serializers.ModelSerializer):
fields = ('value', 'weight',) fields = ('value', 'weight',)
class MotionOptionSerializer(serializers.ModelSerializer): class MotionOptionSerializer(ModelSerializer):
""" """
Serializer for motion.models.MotionOption objects. Serializer for motion.models.MotionOption objects.
""" """
@ -103,7 +103,7 @@ class MotionOptionSerializer(serializers.ModelSerializer):
fields = ('motionvote_set',) fields = ('motionvote_set',)
class MotionPollSerializer(serializers.ModelSerializer): class MotionPollSerializer(ModelSerializer):
""" """
Serializer for motion.models.MotionPoll objects. Serializer for motion.models.MotionPoll objects.
""" """
@ -119,7 +119,7 @@ class MotionPollSerializer(serializers.ModelSerializer):
'votescast',) 'votescast',)
class MotionVersionSerializer(serializers.ModelSerializer): class MotionVersionSerializer(ModelSerializer):
""" """
Serializer for motion.models.MotionVersion objects. Serializer for motion.models.MotionVersion objects.
""" """
@ -134,16 +134,16 @@ class MotionVersionSerializer(serializers.ModelSerializer):
'reason',) 'reason',)
class MotionSerializer(serializers.ModelSerializer): class MotionSerializer(ModelSerializer):
""" """
Serializer for motion.models.Motion objects. Serializer for motion.models.Motion objects.
""" """
versions = MotionVersionSerializer(many=True, read_only=True) versions = MotionVersionSerializer(many=True, read_only=True)
active_version = serializers.PrimaryKeyRelatedField(read_only=True) active_version = PrimaryKeyRelatedField(read_only=True)
submitter = MotionSubmitterSerializer(many=True, read_only=True) submitter = MotionSubmitterSerializer(many=True, read_only=True)
supporter = MotionSupporterSerializer(many=True, read_only=True) supporter = MotionSupporterSerializer(many=True, read_only=True)
state = StateSerializer(read_only=True) state = StateSerializer(read_only=True)
workflow = serializers.SerializerMethodField() workflow = SerializerMethodField()
polls = MotionPollSerializer(many=True, read_only=True) polls = MotionPollSerializer(many=True, read_only=True)
log_messages = MotionLogSerializer(many=True, read_only=True) log_messages = MotionLogSerializer(many=True, read_only=True)

View File

@ -10,7 +10,7 @@ from django.shortcuts import get_object_or_404
from openslides.agenda.views import CreateRelatedAgendaItemView as _CreateRelatedAgendaItemView from openslides.agenda.views import CreateRelatedAgendaItemView as _CreateRelatedAgendaItemView
from openslides.config.api import config from openslides.config.api import config
from openslides.poll.views import PollFormView from openslides.poll.views import PollFormView
from openslides.utils.rest_api import viewsets from openslides.utils.rest_api import ModelViewSet
from openslides.utils.utils import html_strong, htmldiff from openslides.utils.utils import html_strong, htmldiff
from openslides.utils.views import (CreateView, CSVImportView, DeleteView, DetailView, from openslides.utils.views import (CreateView, CSVImportView, DeleteView, DetailView,
ListView, PDFView, QuestionView, ListView, PDFView, QuestionView,
@ -539,11 +539,10 @@ class SupportView(SingleObjectMixin, QuestionView):
return _("You have unsupported this motion successfully.") return _("You have unsupported this motion successfully.")
class MotionViewSet(viewsets.ModelViewSet): class MotionViewSet(ModelViewSet):
""" """
API endpoint to list, retrieve, create, update and destroy motions. API endpoint to list, retrieve, create, update and destroy motions.
""" """
model = Motion
queryset = Motion.objects.all() queryset = Motion.objects.all()
serializer_class = MotionSerializer serializer_class = MotionSerializer
@ -840,11 +839,10 @@ class CategoryDeleteView(DeleteView):
success_url_name = 'motion_category_list' success_url_name = 'motion_category_list'
class CategoryViewSet(viewsets.ModelViewSet): class CategoryViewSet(ModelViewSet):
""" """
API endpoint to list, retrieve, create, update and destroy categories. API endpoint to list, retrieve, create, update and destroy categories.
""" """
model = Category
queryset = Category.objects.all() queryset = Category.objects.all()
serializer_class = CategorySerializer serializer_class = CategorySerializer
@ -886,11 +884,10 @@ class MotionCSVImportView(CSVImportView):
return super(CSVImportView, self).form_valid(form) return super(CSVImportView, self).form_valid(form)
class WorkflowViewSet(viewsets.ModelViewSet): class WorkflowViewSet(ModelViewSet):
""" """
API endpoint to list, retrieve, create, update and destroy workflows. API endpoint to list, retrieve, create, update and destroy workflows.
""" """
model = Workflow
queryset = Workflow.objects.all() queryset = Workflow.objects.all()
serializer_class = WorkflowSerializer serializer_class = WorkflowSerializer

View File

@ -1,9 +1,9 @@
from openslides.utils.rest_api import serializers from openslides.utils.rest_api import ModelSerializer, RelatedField
from .models import Group, User # TODO: Don't import Group from models but from core.models. from .models import Group, User # TODO: Don't import Group from models but from core.models.
class UserShortSerializer(serializers.ModelSerializer): class UserShortSerializer(ModelSerializer):
""" """
Serializer for users.models.User objects. Serializer for users.models.User objects.
@ -21,7 +21,7 @@ class UserShortSerializer(serializers.ModelSerializer):
'groups',) 'groups',)
class UserFullSerializer(serializers.ModelSerializer): class UserFullSerializer(ModelSerializer):
""" """
Serializer for users.models.User objects. Serializer for users.models.User objects.
@ -45,7 +45,7 @@ class UserFullSerializer(serializers.ModelSerializer):
'is_active',) 'is_active',)
class PermissionRelatedField(serializers.RelatedField): class PermissionRelatedField(RelatedField):
""" """
A custom field to use for the permission relationship. A custom field to use for the permission relationship.
""" """
@ -56,7 +56,7 @@ class PermissionRelatedField(serializers.RelatedField):
return '.'.join((value.content_type.app_label, value.codename,)) return '.'.join((value.content_type.app_label, value.codename,))
class GroupSerializer(serializers.ModelSerializer): class GroupSerializer(ModelSerializer):
""" """
Serializer for django.contrib.auth.models.Group objects. Serializer for django.contrib.auth.models.Group objects.
""" """

View File

@ -6,7 +6,7 @@ from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _, ugettext_lazy, activate from django.utils.translation import ugettext as _, ugettext_lazy, activate
from openslides.config.api import config from openslides.config.api import config
from openslides.utils.rest_api import viewsets from openslides.utils.rest_api import ModelViewSet
from openslides.utils.utils import delete_default_permissions, html_strong from openslides.utils.utils import delete_default_permissions, html_strong
from openslides.utils.views import ( from openslides.utils.views import (
CreateView, CSVImportView, DeleteView, DetailView, FormView, ListView, CreateView, CSVImportView, DeleteView, DetailView, FormView, ListView,
@ -261,11 +261,10 @@ class ResetPasswordView(SingleObjectMixin, QuestionView):
return _('The Password for %s was successfully reset.') % html_strong(self.get_object()) return _('The Password for %s was successfully reset.') % html_strong(self.get_object())
class UserViewSet(viewsets.ModelViewSet): class UserViewSet(ModelViewSet):
""" """
API endpoint to list, retrieve, create, update and delete users. API endpoint to list, retrieve, create, update and delete users.
""" """
model = User
queryset = User.objects.all() queryset = User.objects.all()
def check_permissions(self, request): def check_permissions(self, request):
@ -291,11 +290,10 @@ class UserViewSet(viewsets.ModelViewSet):
return serializer_class return serializer_class
class GroupViewSet(viewsets.ModelViewSet): class GroupViewSet(ModelViewSet):
""" """
API endpoint to list, retrieve, create, update and delete groups. API endpoint to list, retrieve, create, update and delete groups.
""" """
model = Group
queryset = Group.objects.all() queryset = Group.objects.all()
serializer_class = GroupSerializer serializer_class = GroupSerializer

View File

@ -3,11 +3,20 @@ import re
from urllib.parse import urlparse from urllib.parse import urlparse
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from rest_framework import response, routers, serializers, viewsets # noqa from rest_framework.serializers import ( # noqa
CharField,
ListSerializer,
ModelSerializer,
PrimaryKeyRelatedField,
RelatedField,
SerializerMethodField)
from rest_framework.response import Response # noqa
from rest_framework.routers import DefaultRouter
from rest_framework.viewsets import ModelViewSet, ViewSet # noqa
from .exceptions import OpenSlidesError from .exceptions import OpenSlidesError
router = routers.DefaultRouter() router = DefaultRouter()
class RESTModelMixin: class RESTModelMixin:

View File

@ -5,7 +5,7 @@ bleach>=1.4,<1.5
django-ckeditor-updated>=4.2.3,<4.4 django-ckeditor-updated>=4.2.3,<4.4
django-haystack>=2.1,<2.4 django-haystack>=2.1,<2.4
django-mptt>=0.6,<0.7 django-mptt>=0.6,<0.7
djangorestframework>=3.0.1,<3.0.5 djangorestframework>=3.0.5,<3.1.0
jsonfield>=0.9.19,<1.1 jsonfield>=0.9.19,<1.1
natsort>=3.2,<3.6 natsort>=3.2,<3.6
reportlab>=3.0,<3.2 reportlab>=3.0,<3.2