问题描述
class User_Profile(models.Model):
userprofilename = models.OneToOneField(settings.AUTH_USER_MODEL,on_delete=models.CASCADE,related_name='user_p')
image_url = models.ImageField(upload_to=upload_location,null=True,blank=True)
date_published = models.DateTimeField(auto_now=True,verbose_name="date published")
date_updated =models.DateTimeField(auto_now=True,verbose_name="date updated")
profile_slug = models.SlugField(blank=True,unique=False)
followers = models.ManyToManyField(settings.AUTH_USER_MODEL,related_name = 'is_following',blank=True,null=True) # user.followers.all()
特定用户的关注者列表
标签: djangodjango-modelsdjango-rest-frameworkmany-to-manymanytomanyfield
解决方案
推荐阅读