Skip to content

Decoded differently than what we see in DB #19

@tiholic

Description

@tiholic
Write Input DB Storage On Read (as relativedelta)
P2M1DT6H "2 mons 1 day 06:00:00" 61 days 6 hours
P1M "1 mon" 30 days
P3M "3 mons" 90 days
P1Y "1 year" 365 days

I was expecting this field to store and retrieve the data in same format. But, the current behaviour is not different from Duration field except that this has more sophisticated options for inputting data.

On some debugging, I noticed that django is reading the values as timedelta by default and then relativedelta field gets hook for transforming the read value.

my requirements.txt

Django==3.2.5
django-relativedelta==1.1.2
psycopg2-binary==2.9.1

PS: I can create a PR if you can suggest on a way how to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions