• Index

django exists query

Reads: 785 Edit

参考资料

https://www.codegrepper.com/code-examples/python/django+exists+query

pass in queryset as filter django

users = UserClasses.objects.filter(class_id=data['class_id'])
user_details = User.objects.filter(id__in=users.values_list('id', flat=True))

django queryset exists

if some_queryset.exists():
    print("There is at least one object in some_queryset")


Comments

Make a comment

www.ultrapower.com ,王硕的博客,专注于研究互联网产品和技术,提供中文精品教程。 本网站与其它任何公司及/或商标无任何形式关联或合作。
  • Index
aaaaa