The logic for calculating the time since, before formatting should also be
pulled out of the function and placed in its own so that custom
implementations can be created.
For example:
With a depth of one it should always display as "1 week" or "3 years" etc.
With a depth of two: "1 week, 3 days" or "3 years, 7 months"
With a depth of three: "1 week, 3 days, 5 hours" or "3 years, 7 months, 2
weeks"
--
Ticket URL: <https://code.djangoproject.com/ticket/31623>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Toby Such
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:1>
* stage: Unreviewed => Accepted
Comment:
As discussed on the ML, the most important thing is to make it easily
customizable.
--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:2>
Old description:
> The timesince function is a bit limiting as it is right now. A `depth`
> parameter should be added to configure how many values are shown. The
> depth parameter should be defaulted to 2 as this is how the current
> implementation behaves. The existing rule of values having to be adjacent
> to one another should still remain.
>
> The logic for calculating the time since, before formatting should also
> be pulled out of the function and placed in its own so that custom
> implementations can be created.
>
> For example:
> With a depth of one it should always display as "1 week" or "3 years"
> etc.
> With a depth of two: "1 week, 3 days" or "3 years, 7 months"
> With a depth of three: "1 week, 3 days, 5 hours" or "3 years, 7 months, 2
> weeks"
New description:
Discussed [https://groups.google.com/forum/#!topic/django-developers
/pEaX5X-wpWo here]. The timesince function is a bit limiting as it is
right now. A `depth` parameter should be added to configure how many
values are shown. The depth parameter should be defaulted to 2 as this is
how the current implementation behaves. The existing rule of values having
to be adjacent to one another should still remain.
The logic for calculating the time since, before formatting should also be
pulled out of the function and placed in its own so that custom
implementations can be created.
For example:
With a depth of one it should always display as "1 week" or "3 years" etc.
With a depth of two: "1 week, 3 days" or "3 years, 7 months"
With a depth of three: "1 week, 3 days, 5 hours" or "3 years, 7 months, 2
weeks"
--
--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:3>
Comment (by Tim Park):
Replying to [comment:1 Toby Such]:
Hey Toby!
I started writing some of the core functionality needed for us to
implement a depth feature. I'm happy to either (1) touch base with you
before going any further or (2) take over this ticket completely.
Let me know.
--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:4>
* owner: Toby Such => Tim Park
--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:5>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/13145 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:6>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:7>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
Comment:
Refactoring (if necessary) can be done in a separate PR/ticket.
--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"8fa9a6d29efe2622872b4788190ea7c1bcb92019" 8fa9a6d]:
{{{
#!CommitTicketReference repository=""
revision="8fa9a6d29efe2622872b4788190ea7c1bcb92019"
Fixed #31623 -- Allowed specifying number of adjacent time units in
timesince()/timeuntil().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31623#comment:9>