Changes between Initial Version and Version 1 of Ticket #30770


Ignore:
Timestamp:
Sep 11, 2019, 7:46:33 AM (5 years ago)
Author:
Jurgis Pralgauskis
Comment:

ps.: here one can workaround by exchanging TruncDay with ExpressionWrapper:

trial_end=ExpressionWrapper(TruncDay('date_joined')+ timedelta(days=30))

But my situation was more complex (I was doing arithmetics in minutes and applying TruncDay few steps later )

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30770

    • Property Summary annotating TruncBase on ExpressionWrapper for date arithmetic, causes unnecessary placeholder "%s" escaping to "%%s"annotating TruncBase on ExpressionWrapper for date arithmetic, causes unnecessary placeholder "%s" escaping to "%%s" and TypeError
  • Ticket #30770 – Description

    initial v1  
    33from django.db.models import F,  DateTimeField, ExpressionWrapper
    44from django.db.models.functions import Cast, Least, Greatest, Now, Coalesce, ExtractWeekDay, TruncDay
     5
    56User.objects
    67   .annotate(trial_end=TruncDay(ExpressionWrapper(F('date_joined')+ timedelta(days=30), output_field=DateTimeField())))
Back to Top