Skip to content

Make PrettyTime play nice with Django F expressions #3

@jdotjdot

Description

@jdotjdot

Right now, though you can use the .then() method for anchoring on arbitrary dates or datetimes, it seems to throw an error when used with Django F expressions, like so:

expiry_date = models.DateField(default=lambda: t(3).months.from_.then(F('publish_date')))

For now, users will have to make do with the following, which does work:

expiry_date = models.DateField(default=lambda: F('publish_date') + relativedelta(months=+3))

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions