Re: get_manager short ut function proposal

2023-01-01 Thread Ramez Ashraf
Mmmm I believe what you shared Shai is very sophisticated than what is proposed. The proposal is a shortcut function for with ability to have a custom parent for more usability for an everyday use , like what's in the documentation about managers. My proposal is *not* a new way to write managers

Re: get_manager short ut function proposal

2023-01-01 Thread Shai Berger
On Sun, 1 Jan 2023 16:33:45 +0200 Ramez Ashraf wrote: > > Interested or do you think the function can be enhanced it to make > more useable for your everyday other cases ? > This is half-baked, just a thought, but maybe you can take it some place interesting: Imagine a class that "collects"

Re: get_manager short ut function proposal

2023-01-01 Thread Ramez Ashraf
Hello Adam Happy new year! Thank you for the feedback, really appreciate it. I thought the same like you at first, a cool function in my project (which is indeed the case) One thing that gave me more incentive is the documentation code example. IMO, i can see how shorter (and more readable) it

Re: get_manager short ut function proposal

2022-12-31 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
Your proposal is quite niche: it only shortens the creation of a Manager class when you need to add a single filter() call. The function seems like it might be a useful helper within a project, if you use many such managers. But custom managers might use any queryset methods, or other logic. I've

get_manager short ut function proposal

2022-12-19 Thread Ramez Ashraf
Hello everyone, I want to propose a helper function `get_manager(parent_manager=None, *args, **kwargs)` A shortcut to return a manager, *args & **kwargs are passed to the manager .filter() pass parent_manager to customize the parent manager, defaults to ``Manager``. it can be used like this