是否可以使用 django orm 生成结果集的哈希值?
Is it possible generate a hash of result set using django orm?
我需要这样的东西:How to generate a hash of the result set in Postgress?
是否可以使用 django orm?
有人有参考资料吗?
对于 Django 的用户模型,它将如下所示:
from django.contrib.auth.models import User
from django.db.models import Concat, Func, CharField
User.objects.annotate(
hash=Func(
Concat('first_name', 'last_name', output_field=CharField()),
function='md5',
)
)
我需要这样的东西:How to generate a hash of the result set in Postgress?
是否可以使用 django orm?
有人有参考资料吗?
对于 Django 的用户模型,它将如下所示:
from django.contrib.auth.models import User
from django.db.models import Concat, Func, CharField
User.objects.annotate(
hash=Func(
Concat('first_name', 'last_name', output_field=CharField()),
function='md5',
)
)