query for string

Hi

I am trying to get a specific record from table:

product = Product.objects.get(category=variable_contains_category_name)

I tried without quotes and with quuotes it is not working.

Thanks.

Specifying variable_contains_category_name without the quotes is correct.

There are at least three different reasons I can think of right off-hand why this query would fail.

It would help if you provided the complete error you are receiving.

is it because the category names are in Arabic?

Maybe, maybe not.

If your database is configured to support Arabic characters, then it shouldn’t matter.

Check your database to verify that what you’re looking for is actually in the table.