More calendar timezone fixes, datetime handling fixes - #570
Conversation
916fdd5 to
2123c19
Compare
f5563b6 to
4a58583
Compare
|
Hi @daym , Thanks for creating this PR, I really appreciate the effort. Would it be possible to split it into smaller changes? It currently includes several features together, which makes it harder to review and merge. If there is an issue in one part, we cannot merge the others that may already be ready. Since this project is used in legacy systems, even small changes can affect existing users. Smaller PRs would make it easier and safer to review and integrate. Thanks again for your work! |
I've now split out the things that need no DB migration--but with the other ones I cannot really split them up because the migrations have (spurious, but django likes it) dependencies. |
665a0e6 to
6e599d7
Compare
Add RuleParam and RuleParamVariant models to enable UI-driven recurrence rule creation instead of manually editing the opaque params text field. - Add RuleParam model (name, display_string) - Add RuleParamVariant model (param FK, value, value_display_string) - Add Rule.repeats ManyToManyField to RuleParamVariant - Make Rule.name unique with max_length=255 - Add Rule.ensure_rule() classmethod for find-or-create - Add RuleAdmin fields and filter_horizontal for repeats - Update tests for unique Rule.name constraint
Add updater ForeignKey field to Event model for audit trail in collaborative editing. Also update creator related_name to created_events for consistency.
Add color_event CharField to Calendar model for FullCalendar display colors. Add CalendarForm with ColorInput widget, update CalendarAdmin fieldsets, and add ordering by name to Calendar.Meta.
Add timezone CharField to Event for DST-correct recurrences. Refactor rrule generation to use event-local naive datetimes. Add _localize() helper. Add event_tzinfo property using ZoneInfo. Add database-level CheckConstraint ensuring end >= start. Update tests for new timezone handling and occurrence hash/equality semantics.
Replace pytz with stdlib datetime.timezone.utc in _normalize_timezone_to_utc. Use utc_start/utc_end for occurrence filtering in Period class. Add rule__repeats to prefetch_related for O(1) query count. Remove pytz from project dependencies.
Switch models/__init__.py to relative imports.
Principles: