ModelForm field autofocus

2022-08-26 Thread Christian González
Hi devs, I often come across the problem that I want to have a field take the autofocus in Django. Especially when dealing with high abstraction when using ModelForms, this is barely possible using templates, so the only way is to create a ModelForm subclass and tell it to put the autofocus

Re: A generic cache decorator around low level cache api

2022-08-26 Thread suayip uzulmez
It doesn't necessarily have to be a QuerySet; any function or method that takes some processing time could be decorated (e.g., an external call to an API). My aim is to reduce this code: def do_some_processing(): cache_key = "key" if cached_value := cache.get(cache_key): return

Re: A generic cache decorator around low level cache api

2022-08-26 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
I'm not sure I quite understand your proposal. Are you suggesting a decorator that caches the results of every queryset that is resolved within the decorated function? If so, I'm not sure how useful it would be. First, if a single query is problematic, there’s normally a way to optimize it within