> If you're using MySQL then this should work:
>
> models.User.objects.extra(where=["concat(first_name, ' ', last_name)=%s"],
> params=["John Test"])
>
> Not sure how portable the concat function is or what alternatives are there
> in other backends but shouldn't be very hard to find out.
Well, if full_name is not a property in your model but first_name and
last_name are, then you could do
q = User.objects.filter(first_name='John', last_name='Smith')
Mike
No comments:
Post a Comment