TemplateResponseMixin需要在DRF中定义“ template_name”或实现“ get_template_names()”

时间:2019-03-27 12:08:03

标签: django-rest-framework django-rest-auth

我正在尝试在django rest框架中确认电子邮件地址,但出现错误

我更改了网址格式,并从allauth导入confirm_email视图表单,但仍然收到错误

urls.py

 from allauth.account.views import confirm_email
    urlpatterns = [
    path('rest-auth/registration/account-confirm-email/(?P<key>.+)/', confirm_email, name='account_confirm_email'),
    ]

views.py

from django.shortcuts import render
from rest_framework import generics

#for facebook authentication
from allauth.socialaccount.providers.facebook.views import FacebookOAuth2Adapter
from rest_auth.registration.views import SocialLoginView
from . import models
from . import serializers


class UserListView(generics.ListCreateAPIView):
    queryset = models.CustomUser.objects.all()
    serializer_class = serializers.UserSerializer

class FacebookLogin(SocialLoginView):
    adapter_class = FacebookOAuth2Adapter

0 个答案:

没有答案