Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
prablordeppey opened this issue May 17, 2020 · 1 comment
Open

Comments

@prablordeppey
Copy link

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?

@abastardi
Copy link
Collaborator

abastardi commented May 17, 2020

Please show your code. pyDAL will have no idea this is a date field without that being specified somehow, so nothing in pyDAL or web2py would force validation as a date. There must be something else going on. Also, what do you mean that it "validates as a date"? Are you talking about form validation, or do you get an error from the database?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants