#22394: Several built in Lookups should actually be Transforms
-------------------------------------+-------------------------------------
     Reporter:  smeatonj             |                    Owner:  mjtamlyn
         Type:  Uncategorized        |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:
     Keywords:  lookups              |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by akaariai):

 There is a way to have year lookup as a Transform, and also have
 specialized Lookups for exact and friends. The way to do this is to write
 YearExact's as_sql() in a way that it accesses directly self.lhs.lhs, that
 is YearExact doesn't execute self.lhs.as_sql() at all, instead it skips
 directly to the column of self.lhs. This works as self.lhs is known to be
 a YearTransform instance, only way to access YearExact is through
 YearTransform.

 As it happens this has already been written as a test case in
 custom_lookups. Check YearTransform and YearExact in
 custom_lookups/tests.py. The implementation is PostgreSQL specific, so
 there is some work to make it generic.

 BTW for the kickstarter part - I think it is completely fair if somebody
 else has time to work on this and implements it for you for your
 kickstarter project. If you would be able to just merge patches others
 wrote I think that would be completely fair way to accomplish your
 kickstarter project. Of course, this is just my opinion.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22394#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.343007b0f7286882df54a73e5aafa891%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to