openoakland / dos-census-events

Day of Service project to collect and publish events and resources for the 2020 census
3 stars 5 forks source link

google_publish command failing, no attribute 'start_datetime' #54

Closed adborden closed 4 years ago

adborden commented 4 years ago

When we refactored the Event model to drop the start_datetime and end_datetime, we didn't update the google_publish method.

$ pipenv run python manage.py google_publish
Loading .env environment variables…
2019-11-10 19:51:17,253 [census.management.commands.google_publish] INFO starting publish...
2019-11-10 19:51:17,258 [census.management.commands.google_publish] INFO event not yet published event=1
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/home/adborden/.local/share/virtualenvs/dos-census-events-JxEkV-SB/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/adborden/.local/share/virtualenvs/dos-census-events-JxEkV-SB/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/adborden/.local/share/virtualenvs/dos-census-events-JxEkV-SB/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/adborden/.local/share/virtualenvs/dos-census-events-JxEkV-SB/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/home/adborden/projects/dayofsevice/dos-census-events/census/management/commands/google_publish.py", line 31, in handle
    google_publish_event(event)
  File "/home/adborden/projects/dayofsevice/dos-census-events/census/google_calendar.py", line 25, in google_publish_event
    'dateTime': event.start_datetime.isoformat(),
AttributeError: 'Event' object has no attribute 'start_datetime'
adborden commented 4 years ago

I've been thinking about the Google Calendar API and the iCalendar format for recurreence, and I think we do want specific start/end datetimes. I think we should hide the recurrence widget by default, and only show it when the user selects "this event recurs", similar to the Google Calendar UI.

Right now, it's possible to set a start time, end time, and recurrence rule with no date. Which should be invalid. The recurrence widget allows dates to be entered as "exceptions", recurrences that can't really be expressed by rules e.g. M, T this week, and W next week.

adborden commented 4 years ago

Also without having explicit start/end datestimes, it gets hairy to say starts at 11pm Nov 10th, and ends 1am Nov 11th.