Change `to_python` and `to_url` to be class methods on path converters

2022-08-24 Thread Petter friberg
Hi, I ran in to the situation of wanting `to_python` and `to_url` be decorated with `@classmethod` to avoid having to declare an additional (kind of no-op) class with those 2 methods. Given that I have a couple of custom python data structures that can be encoded into path params, it would be

A generic cache decorator around low level cache api

2022-08-24 Thread suayip uzulmez
Usually, I need to construct a simple cache pipeline to optimize database access using low-level cache API (django.core.cache). I think we could use a decorator as such to ease this process: cached_context(key, *, timeout, cache) I know higher-level utilities exist such as cache_page, however

Re: Make timeout property for PasswordResetTokenGenerator

2022-08-24 Thread Carlton Gibson
Hey Robert. > ... the argument here is "we don't want to", but the reasoning behind that is unclear ... For me, the reasoning would be that we get several security reports against Django pretty much every week, and the extent to which we make security sensitive areas **generic** for the sake of

Re: Feature Request (have sample implemenation): ALL subquery

2022-08-24 Thread David Sanders
I'm no expert on how PG optimises queries but NOT EXISTS appears to produce the desired execution plan. My original rationale was to improve the readability and "solution accessibility" for lack of a better term. This all came about because a colleague couldn't figure out how to do it as a

Re: Feature Request (have sample implemenation): ALL subquery

2022-08-24 Thread charettes
Hello David, Do you know if ALL provides any performance benefits over NOT EXISTS? Given we already support Employee.objects.filter( ~Exists(Employee.objects.filter( manager=OuterRef("pk"), join_date__gt=OuterRef("join_date") ) ) If it's not the case I'm not sure

Feature Request (have sample implemenation): ALL subquery

2022-08-24 Thread David Sanders
Hi folks! I have a piece of low hanging fruit I'd like to suggest and contribute: ALL subqueries. Here's the PG docs on ALL subqueries but basically it causes the subquery expression to evaluate to true

Re: Make timeout property for PasswordResetTokenGenerator

2022-08-24 Thread Contributions to Django itself
Hey Carlton, I'm reading through the replies and I feel like I'm missing point completely. First some background - `PasswordResetTokenGenerator` is heavily referenced over the web (or more accurately - the `default_token_genrator`) when it comes to account activation. I personally believe the

Re: Named Groups for Enumeration Types

2022-08-24 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
Hi Steven I agree that grouped choices would be nice to support in the enum types. Thank you for taking a look at this. I'm not sure about either of your proposed syntaxes. They both seem error prone and unclear to me. I propose instead using a separate grouping attribute: class