Skip to content

How to call Django models etc #5

@Mte90

Description

@Mte90

I did this code:

from asgiref.sync import sync_to_async
async def wrap_async(method, **parameters):
	return await sync_to_async(method)(**parameters)

In this way from nicegui I can do stuff like: user = await wrap_async(User.objects.get, id=user_id) but can be used also for other stuff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions