Sobes.tech
Junior — Senior

Sending Django model User to a Celery task

livecode

Task condition

Check whether the delayed task call change_user_status.delay(usr) works correctly when passing an instance of the Django User model. Ensure that the object is properly serialized, and discuss the possibility of passing only its identifier instead of the full model.

from django.contrib.auth import get_user_model

User = get_user_model()
usr = User.objects.get(id=1)

change_user_status.delay(usr)