1👍
✅
Instead of providing the category.id
just give the category object itself.
card = Card.objects.filter(category=category,
question='Hello?',
answer='Hello!',
slug='slug'
)
I am using filter instead of get in case you have multiple object for the given parameters.
Source:stackexchange.com