我正在学习Python Django框架。感谢StackOverFlow社区,我已经学会了如何在django中使用open-id(social_auth我正在使用)。
使用social_auth,登录和退出流程非常简单实用。但是我想在用户之间建立友谊关系,为此我创建了新的模型类,它从from django.contrib.auth.models import User
扩展并在auth_table中创建新用户时添加控件,我在CustomUser Table上创建新用户。(它效率不高。)因为来自open-id的参数对于每个open-id连接是不同的)
我的型号代码在这里
from datetime import datetime
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.contrib.auth.models import User
from django.contrib.auth.models import UserManager
# Create your models here.
class CustomUser(User):
gender = models.CharField(max_length=50)
location = models.CharField(max_length=50)
bio = models.CharField(max_length=50)
web_pages = models.CharField(max_length=50)
friends = models.ManyToManyField("self")
如何在Django中一起使用CustomUser模型和OpenID进行身份验证?
任何帮助将不胜感激。