Skip to content

Foreign Key constraint error with custom date/datetime fields #427

@prablordeppey

Description

@prablordeppey

I defined my own custom date_of_birth field in 2 different tables without specifying the data type. I thought by default, web2py will validate as string.

The first table had no issues. I was able to successfully set the date_of_birth as string or group of random characters anyhow I wanted. But for the second table, I spent the whole night debugging my application, thinking I made a mistake somewhere but later to realize the next day that web2py was validating the date_of_birth field as a date type rather than as string.
I also found out that, it doesnt matter if I specify a data type (string) for my date_of_birth field. It still validates as a date.

It will be a good thing if it is documented somewhere in the book about default data types.
Why is this so? is it a bug or its intentional? and are there similar names we shouldn't use as field names aside those that return unacceptable by web2py when we do use them?

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