I think I proposed V as an alias back when I was writing the patch, but the rough consensus at the time was that one letter class names are a bit of an anti pattern (Q, F) that we shouldn't persist with. Aliasing V in the examples was my way of sneaking the idea through for those who chose to act similarly. I'd be ok with providing an alias, but I think examples should still import the Value name to make the code more clear what V actually refers to.
On Monday, 3 April 2017 17:58:43 UTC+10, Adam Johnson wrote: > > When writing filter expressions using database functions, one is often > forced to use django.db.models.Value to wrap raw values to avoid them > being interpreted as column references. Value is fairly cumbersome to > write when it can appear several times in a complex queryset definition, so > it's common to alias it as V when importing. In fact, the database > function docs do this exclusively > <https://docs.djangoproject.com/en/1.10/ref/models/database-functions/>. > > Because import as is sometimes considered bad style, but the V alias is > useful, I'd like to propose django.db.models having a documented internal > alias like V = Value. I'm writing here because I can't think of a > precedent in Django, except for backwards compatibility reasons. > > -- > Adam > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/1e4d267e-7441-489f-a2ac-c23f34cd246c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
