I'm trying to switch from WSGI to ASGI and I'm having issues with my model 
id to model converters.
I define my converters like this
def to_python(self, primary_key):
     try:
          return self.model.objects.get(pk=primary_key)
     except self.model.DoesNotExist:
          raise ValueError
When I go to a url where a converter is used I get a 
SynchronousOnlyOperation.
Seems like converters are executed in an async context.
If I use sync_to_async, I get a coroutine in my view instead of a model 
instance. Awaiting it here would defeat the purpose of having a converter.

Any ideas how to fix this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ef60ed71-7f4f-482d-b540-bdf89e249aa4n%40googlegroups.com.

Reply via email to