-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
Implement display options for Duration type #1091
Conversation
…tions' into mathesar-433-duration-display-options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@silentninja It seems like this point from #433 is not addressed here:
(4) We should add supported display options to the types endpoint.
See individual comments also.
@@ -256,6 +257,7 @@ def test_column_create_display_options( | |||
name = "anewcolumn" | |||
data = {"name": name, "type": type_, "display_options": display_options} | |||
response = client.post(f"/api/db/v0/tables/{column_test_table.id}/columns/", data) | |||
print(response.data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this print statement.
@@ -180,6 +180,14 @@ def validate(self, datetime_obj, display_format, serializer_field): | |||
return super().validate(datetime_obj, display_format, serializer_field) | |||
|
|||
|
|||
class DurationFormatValidator(TimeWithoutTimeZoneFormatValidator): | |||
""" | |||
The validation is same as Time Without TimeZone as of now, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not make sense. Durations can span weeks, months, days, and years. Times cannot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it, it was meant to be timestamp. I have changed the validation method anyway since we need a different error message, though the logic is similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I haven't restricted using a weekdate
format string(2019-W17), though the duration value returned from the database follows RFC 3339 and does not return a weekdate, as the user might have a different requirement
I also wanted to verify that this point was addressed, I don't see it anywhere.
|
Codecov Report
@@ Coverage Diff @@
## master #1091 +/- ##
==========================================
- Coverage 93.25% 93.24% -0.02%
==========================================
Files 112 112
Lines 4078 4084 +6
==========================================
+ Hits 3803 3808 +5
- Misses 275 276 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
…tions' into mathesar-433-duration-display-options
This was handled as part of the initial display options PR, it is taken care of when a column is reflected |
Available Display options are part of the types serializer. I have added it to the list |
Sorry I missed this, I think I reviewed too many PRs in a row. :/ |
Fixes #433
Adds display options for the
duration type
.Checklist
Update index.md
).master
branch of the repositoryvisible errors.
Developer Certificate of Origin
Developer Certificate of Origin