How to use the eventy.models.EventTime.upcoming_objects function in eventy

To help you get started, we’ve selected a few eventy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github powellc / django-eventy / eventy / templatetags / eventy_tags.py View on Github external
def render(self, context):
        if self.calendar_slug == 'all':
            events = EventTime.upcoming_objects.all().order_by('start')
        else:
            events = EventTime.upcoming_objects.filter(event__calendar__slug=self.calendar_slug).order_by('start')

        if self.excluded_cals:
            for cal_slug in self.excluded_cals:
                events = events.exclude(event__calendar__slug=cal_slug)

        logging.debug('Fetching %s events from calendar %s excluding %s.' % (self.limit, self.calendar_slug, self.excluded_cals))
        if self.limit == 1:
            try:
                context[self.varname] = events[0]
            except:
                context[self.varname] = None
        else:
            try:
                context[self.varname] = events[:self.limit]
github powellc / django-eventy / eventy / templatetags / eventy_tags.py View on Github external
def render(self, context):
        if self.calendar_slug == 'all':
            events = EventTime.upcoming_objects.all().order_by('start')
        else:
            events = EventTime.upcoming_objects.filter(event__calendar__slug=self.calendar_slug).order_by('start')

        if self.excluded_cals:
            for cal_slug in self.excluded_cals:
                events = events.exclude(event__calendar__slug=cal_slug)

        logging.debug('Fetching %s events from calendar %s excluding %s.' % (self.limit, self.calendar_slug, self.excluded_cals))
        if self.limit == 1:
            try:
                context[self.varname] = events[0]
            except:
                context[self.varname] = None
        else:
            try:
                context[self.varname] = events[:self.limit]
            except:
                context[self.varname] = None
github powellc / django-eventy / eventy / views.py View on Github external
def get_queryset(self):
        try:
            cal_slug = self.kwargs['cal_slug']
            self.calendar = get_object_or_404(Calendar, slug=cal_slug)
        except:
            self.calendar = None
        return EventTime.upcoming_objects.all()
github powellc / django-eventy / eventy / views.py View on Github external
def get_queryset(self):
        try:
            if self.kwargs['cal_slug']:
                return EventTime.upcoming_objects.filter(event__calendar__slug=self.kwargs['cal_slug'])
        except:
            pass

        try:
            if self.kwargs['slug']:
                return EventTime.upcoming_objects.filter(event__slug=self.kwargs['slug'])
        except:
            logging.debug('Returning all upcoming events...')
            return EventTime.upcoming_objects.all()