2014-08-22 15:31:44 +00:00
|
|
|
from rest_framework import viewsets
|
|
|
|
|
2014-10-07 13:08:59 +00:00
|
|
|
from orchestra.api import router, SetPasswordApiMixin
|
2014-08-22 15:31:44 +00:00
|
|
|
from orchestra.apps.accounts.api import AccountApiMixin
|
|
|
|
|
|
|
|
from .models import Address, Mailbox
|
|
|
|
from .serializers import AddressSerializer, MailboxSerializer
|
|
|
|
|
|
|
|
|
|
|
|
class AddressViewSet(AccountApiMixin, viewsets.ModelViewSet):
|
|
|
|
model = Address
|
|
|
|
serializer_class = AddressSerializer
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-07 13:08:59 +00:00
|
|
|
class MailboxViewSet(SetPasswordApiMixin, AccountApiMixin, viewsets.ModelViewSet):
|
2014-08-22 15:31:44 +00:00
|
|
|
model = Mailbox
|
|
|
|
serializer_class = MailboxSerializer
|
|
|
|
|
|
|
|
|
|
|
|
router.register(r'mailboxes', MailboxViewSet)
|
|
|
|
router.register(r'addresses', AddressViewSet)
|