我的示例代码是:
from django.db import models
from django.contrib.auth.models import User
class Category(models.Model):
user = models.ForeignKey(User, null=True)
....
我想做一些这样的事情:
user = User.objects.none()
categories = Category.objects.filter(**filter)
for category in categories:
# my problem is here , how add user category object to queryset
# or merge object and queryset
user = user | category.user
这部分代码用于显示问题:
user = user | category.user
谢谢。