21 lines
446 B
Python
21 lines
446 B
Python
|
from rest_framework import routers, viewsets, serializers
|
||
|
|
||
|
from mail.models import Email
|
||
|
|
||
|
|
||
|
class EmailSerializer(serializers.ModelSerializer):
|
||
|
class Meta:
|
||
|
model = Email
|
||
|
fields = '__all__'
|
||
|
|
||
|
|
||
|
class EmailViewSet(viewsets.ModelViewSet):
|
||
|
serializer_class = EmailSerializer
|
||
|
queryset = Email.objects.all()
|
||
|
|
||
|
|
||
|
router = routers.SimpleRouter()
|
||
|
router.register(r'mails', EmailViewSet, basename='mails')
|
||
|
|
||
|
urlpatterns = router.urls
|