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

How to customize GET_EVENTS_FUNC for CalendarByPeriodsView? #549

Open
h3x4git opened this issue Feb 16, 2023 · 1 comment
Open

How to customize GET_EVENTS_FUNC for CalendarByPeriodsView? #549

h3x4git opened this issue Feb 16, 2023 · 1 comment

Comments

@h3x4git
Copy link

h3x4git commented Feb 16, 2023

I need to limit the events displayed by the calendars to the city where the events will take place so I defined a model that inherits directly from Event like this:

from schedule.models import events
from city_app.models import City

class CityEvent(events.Event):
    city = models.ForeignKey(City, on_delete=models.CASCADE)

I hope to be able to serve this events via the same Calendar / Period system that this great package ships with.

I would like to be able to change the way GET_EVENTS_FUNC works inside CalendarByPeriodsView so that it will accept the request, the calendar, and a city object. I think I could just create another mixin CalendarByPeriodsByCityView, passing it a "city" kwarg via the url and define another get_context_data() including a different event_list value (with a custom function) but I'm reading in settings.py comments that GET_EVENTS_FUNC is a callable used to customize the event list given for a calendar and user so I wonder if this could also apply to my situation, is there a clean way to add a parameter to this function without interfering with your code or overriding it?

@h3x4git
Copy link
Author

h3x4git commented Feb 20, 2023

I could painlessly turn the events.Event model of django-scheduler into a polymorphic model for downcasting by simply applying the django-polymorphic directives and migrating. I would suggest this could be a feature request of mine

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

1 participant