Ticket #4158 (closed defect: fixed)
Opened 5 years ago
Last modified 5 years ago
[PATCH] - Display DateTime values in Query Results correctly
| Reported by: | ilias@… | Owned by: | cboos |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.11 |
| Component: | report system | Version: | devel |
| Severity: | minor | Keywords: | datetime |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description
the patch enables the dispaly of 'time' and 'changetime' fields (if available), otherwise the behaviour remains the same:
It is identical to the patch suggested by mgood within this thread
See line 140 of this patch
Attachments
Change History
comment:1 follow-ups: ↓ 2 ↓ 6 Changed 5 years ago by cboos
- Keywords datetime added
- Milestone set to 0.11
- Owner changed from mgood to cboos
- Severity changed from normal to minor
comment:2 in reply to: ↑ 1 Changed 5 years ago by ilias@…
Replying to cboos:
Thanks, though it looks preferable to do that based on type of the column.
...which is not yet defined.
I've 'back-developed' my patches to not affect the ticket api (as suggested by mgood):
http://groups.google.com/group/trac-dev/msg/61c2134c408c1296
So, at this point the field type definition does not exist thus looking for 'datetime' would not work. The suggested patch does the work fine (until the fields api is refactored/extended).
-
templates/query_div.html
48 48 <td py:when="idx == 0" class="id"><a href="$result.href" title="View ticket">#$result.id</a></td> 49 49 <td py:otherwise="" class="$header.name" py:choose=""> 50 50 <a py:when="header.name == 'summary'" href="$result.href" title="View ticket">$result.summary</a> 51 <span py:when="header.name in ('time', 'changetime')">${format_datetime(result[header.name])}</span> 51 52 <span py:otherwise="">${result[header.name]}</span> 52 53 </td> 53 54 </py:for>
comment:3 follow-up: ↓ 4 Changed 5 years ago by cboos
Note that I've checked directly the type of the value: isinstance(value, datetime)
comment:4 in reply to: ↑ 3 Changed 5 years ago by ilias@…
Replying to cboos:
Note that I've checked directly the type of the value: isinstance(value, datetime)
Oh yes, I see (a little bit overworked).
This would be a more elegant generic solution.
Of course it should be prefered.
comment:5 Changed 5 years ago by ilias@…
I've applied the patch and it works fine on the server, so for me it fine if it goes in trunk this way.
comment:6 in reply to: ↑ 1 Changed 5 years ago by cboos
- Resolution set to fixed
- Status changed from new to closed
Patch applied in r4292.



Thanks, though it looks preferable to do that based on type of the column.
query_div.html