from django.db import models
import logging

logger = logging.getLogger(__name__)


class EventsManager(models.Manager):
    def get_actual(self) -> 'Event':
        """
        Returns the actual event for this event.
        If there is no actual event, it returns the last event.
        :return: Event
        """
        try:
            return self.get_queryset().filter(is_actual=True).first()
        except Exception as e:
            raise e