# Path: konfera/models/abstract.py
# class FromToModel(KonferaModel):
# 
#     class Meta:
#         abstract = True
# 
#     date_from = models.DateTimeField(verbose_name=_('Available from'), blank=True)
#     date_to = models.DateTimeField(verbose_name=_('Available to'), blank=True)
# 
#     def clean(self):
#         if self.date_from and self.date_to and self.date_from >= self.date_to:
#             msg = _('%(date_from)s have to be before %(date_to)s.') % {
#                 'date_from': self._meta.get_field('date_from').verbose_name,
#                 'date_to': self._meta.get_field('date_to').verbose_name
#             }
# 
#             raise ValidationError({'date_from': msg, 'date_to': msg})


import json
from django.core.exceptions import ValidationError
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from konfera.models.abstract import FromToModel




class EventManager(models.Manager):
    def published(self):
        return self.get_queryset().filter(status=Event.PUBLISHED).select_related('location')


class Event(FromToModel):
    CONFERENCE = 'conference'
    MEETUP = 'meetup'

    EVENT_TYPE_CHOICES = (
        (CONFERENCE, _('Conference')),
        (MEETUP, _('Meetup')),
    )

    DRAFT = 'draft'

# Path: konfera/models/abstract.py
# class FromToModel(KonferaModel):
# 
#     class Meta:
#         abstract = True
# 
#     date_from = models.DateTimeField(verbose_name=_('Available from'), blank=True)
#     date_to = models.DateTimeField(verbose_name=_('Available to'), blank=True)
# 
#     def clean(self):
#         if self.date_from and self.date_to and self.date_from >= self.date_to:
#             msg = _('%(date_from)s have to be before %(date_to)s.') % {
#                 'date_from': self._meta.get_field('date_from').verbose_name,
#                 'date_to': self._meta.get_field('date_to').verbose_name
#             }
# 
#             raise ValidationError({'date_from': msg, 'date_to': msg})


# Path: konfera/models/event.py
import json
from django.core.exceptions import ValidationError
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from konfera.models.abstract import FromToModel





class EventManager(models.Manager):
    def published(self):
        return self.get_queryset().filter(status=Event.PUBLISHED).select_related('location')


class Event(FromToModel):
    CONFERENCE = 'conference'
    MEETUP = 'meetup'

    EVENT_TYPE_CHOICES = (
        (CONFERENCE, _('Conference')),
        (MEETUP, _('Meetup')),
    )

    DRAFT = 'draft'

    PUBLISHED = 'published'