django-orchestra/orchestra/contrib/mailboxes/api.py

23 lines
689 B
Python

from rest_framework import viewsets
from orchestra.api import router, SetPasswordApiMixin, LogApiMixin
from orchestra.contrib.accounts.api import AccountApiMixin
from .models import Address, Mailbox
from .serializers import AddressSerializer, MailboxSerializer
class AddressViewSet(LogApiMixin, AccountApiMixin, viewsets.ModelViewSet):
queryset = Address.objects.all()
serializer_class = AddressSerializer
class MailboxViewSet(LogApiMixin, SetPasswordApiMixin, AccountApiMixin, viewsets.ModelViewSet):
queryset = Mailbox.objects.all()
serializer_class = MailboxSerializer
router.register(r'mailboxes', MailboxViewSet)
router.register(r'addresses', AddressViewSet)