def _process(self): if not request.is_xhr: return WPCategoryCalendar.render_template( 'display/calendar.html', self.category, start_dt=request.args.get('start_dt')) tz = self.category.display_tzinfo start = tz.localize(dateutil.parser.parse( request.args['start'])).astimezone(utc) end = tz.localize(dateutil.parser.parse( request.args['end'])).astimezone(utc) query = (Event.query.filter(Event.starts_between(start, end), Event.is_visible_in(self.category.id), ~Event.is_deleted).options( load_only('id', 'title', 'start_dt', 'end_dt', 'category_id'))) events = self._get_event_data(query) ongoing_events = (Event.query.filter( Event.is_visible_in(self.category.id), Event.start_dt < start, Event.end_dt > end).options( load_only('id', 'title', 'start_dt', 'end_dt', 'timezone')).order_by(Event.title).all()) return jsonify_data( flash=False, events=events, ongoing_event_count=len(ongoing_events), ongoing_events_html=self._render_ongoing_events(ongoing_events))
def _process(self): if not request.is_xhr: return WPCategoryCalendar.render_template('display/calendar.html', self.category, start_dt=request.args.get('start_dt')) tz = self.category.display_tzinfo start = tz.localize(dateutil.parser.parse(request.args['start'])).astimezone(utc) end = tz.localize(dateutil.parser.parse(request.args['end'])).astimezone(utc) query = (Event.query .filter(Event.starts_between(start, end), Event.is_visible_in(self.category), ~Event.is_deleted) .options(load_only('id', 'title', 'start_dt', 'end_dt', 'category_id'))) events = self._get_event_data(query) ongoing_events = (Event.query .filter(Event.is_visible_in(self.category), Event.start_dt < start, Event.end_dt > end) .options(load_only('id', 'title', 'start_dt', 'end_dt', 'timezone')) .order_by(Event.title) .all()) return jsonify_data(flash=False, events=events, ongoing_event_count=len(ongoing_events), ongoing_events_html=self._render_ongoing_events(ongoing_events))
def _process(self): return WPCategoryCalendar.render_template('display/calendar.html', self.category)