简体   繁体   English

如何注释 django 对象中的字符串

[英]How to annotate strings in django objects

I want to concatinate first name + last name but i'm getting 0 as a value of full name我想连接名字+姓氏,但我得到0作为全名的值

What I'm trying to do is this我想做的是这个

Customer.objects.annotate(full_name=F('first_name') + F('last_name')).filter(full_name='Filan Fisteku')
from django.db.models import Value
from django.db.models.functions import Concat


ss = Customer.objects.annotate(full_name=Concat('first_name', Value(' '), 'last_name')).filter(full_name='Filan Fisteku')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM