Projet

Général

Profil

Development #37433

LazyFieldVarDate, ajouter .year, .month, .day

Ajouté par Frédéric Péters il y a plus de 4 ans. Mis à jour il y a environ 4 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
05 novembre 2019
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

Dans une trace de quelqu'un tentant d'utiliser |timesince,

Exception:
  type = '<type 'exceptions.AttributeError'>', value = ''LazyFieldVarDate' object has no attribute 'year''

Stack trace (most recent call first):
  File "/usr/lib/python2.7/dist-packages/django/utils/timesince.py", line 36, in timesince
    34     # Convert datetime.date to datetime.datetime for comparison.
    35     if not isinstance(d, datetime.datetime):
>   36         d = datetime.datetime(d.year, d.month, d.day)
    37     if now and not isinstance(now, datetime.datetime):
    38         now = datetime.datetime(now.year, now.month, now.day)

  locals:
     d = <wcs.variables.LazyFieldVarDate object at 0x7fe5a0d217d0>
     now = <wcs.variables.LazyFieldVarDate object at 0x7fe5a0d21190>
     reversed = False

  File "/usr/lib/python2.7/dist-packages/django/template/defaultfilters.py", line 796, in timesince_filter
   794         return timesince(value)
   795     except (ValueError, TypeError):
>  796         return ''
   797
   798

On pourrait avoir les attributs nécessaires sur LazyFieldVarDate.


Fichiers

Révisions associées

Révision 071d35e7 (diff)
Ajouté par Frédéric Péters il y a environ 4 ans

misc: add year/month/day variables to lazy date fields (#37433)

Historique

#1

Mis à jour par Frédéric Péters il y a environ 4 ans

#2

Mis à jour par Thomas Noël il y a environ 4 ans

  • Statut changé de Solution proposée à Solution validée
#3

Mis à jour par Frédéric Péters il y a environ 4 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit 071d35e768726f1b62ec562e8903b210526d2d87
Author: Frédéric Péters <fpeters@entrouvert.com>
Date:   Sat Jan 18 12:58:45 2020 +0100

    misc: add year/month/day variables to lazy date fields (#37433)
#4

Mis à jour par Frédéric Péters il y a environ 4 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF