Re: register_converter doesn't work with ASGI

2022-01-28 Thread madhav
What is the problem you are trying to solve? What do you want to optimize exactly? 🤔 hope this course helps you : https://acciojob.com/ On Monday, June 28, 2021 at 7:36:38 AM UTC+5:30 David Nugent wrote: > Well, one workaround that may serve if your dataset isn't too large is to > use a cache

Re: register_converter doesn't work with ASGI

2021-06-27 Thread David Nugent
Well, one workaround that may serve if your dataset isn't too large is to use a cache (or dict) and pre-load it. Unlike the db, caches tend to be more async friendly, unless of course your cache is in your db :-) This just needs to be pre-loaded on startup (.apps.:.ready() is a good spot for

Re: register_converter doesn't work with ASGI

2021-06-21 Thread Konstantin Kuchkov
Thanks for the explanation! To get it working, I will replace my model converters with basic converters and do corresponding lookups in the views. On Sunday, 20 June 2021 at 16:16:58 UTC-7 Andrew Godwin wrote: > Ah yes, that's because the URL parsing/conversion all happens in the main > (async

Re: register_converter doesn't work with ASGI

2021-06-20 Thread Andrew Godwin
Ah yes, that's because the URL parsing/conversion all happens in the main (async, in ASGI mode) thread - and because to_python is a a synchronous function interface, there is literally nothing you can do to make it work. The only real way of fixing this would be for Django to patch the URL conv

register_converter doesn't work with ASGI

2021-06-18 Thread konstanti...@gmail.com
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 W

Re: register_converter

2020-05-06 Thread Andréas Kühne
in the main urls.py file (which is usually in >> the main project name, alongside settings.py). That's all you need to do. >> >> I don't know about the slug converter though - I would just reregister it >> and see what happens :) >> >> Regards, >> &

Re: register_converter

2020-05-06 Thread אורי
t reregister it > and see what happens :) > > Regards, > > Andréas > > > ‪Den ons 6 maj 2020 kl 11:23 skrev ‫אורי‬‎ :‬ > >> Hi, >> >> Do I have to use register_converter in any file using it? I have a >> project with many urls.py files, and I want to

Re: register_converter

2020-05-06 Thread Andréas Kühne
2020 kl 11:23 skrev ‫אורי‬‎ :‬ > Hi, > > Do I have to use register_converter in any file using it? I have a project > with many urls.py files, and I want to register converters which will be > used in multiple files. How do I register them? Do I have to register them > in all the

register_converter

2020-05-06 Thread אורי
Hi, Do I have to use register_converter in any file using it? I have a project with many urls.py files, and I want to register converters which will be used in multiple files. How do I register them? Do I have to register them in all the urls.py files? And where in my project should I put the