Home > Enterprise >  How to annotate strings in django objects
How to annotate strings in django objects

Time:11-20

I want to concatinate first name last name but i'm getting 0 as a value of full name

What I'm trying to do is this

Customer.objects.annotate(full_name=F('first_name')   F('last_name')).filter(full_name='Filan Fisteku')

CodePudding user response:

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')

  • Related