# Path: cpm_generic/models.py
# class TranslatedField(object):
#     def __init__(self, en_field, be_field, ru_field):
#         self.en_field = en_field
#         self.be_field = be_field
#         self.ru_field = ru_field
# 
#     def __get__(self, instance, owner):
#         fields = {
#             'en': self.en_field,
#             'be': self.be_field,
#             'ru': self.ru_field,
#         }
#         field = fields.get(translation.get_language(), self.en_field)
#         return getattr(instance, field)
# 
# Path: modeladminutils/edit_handlers.py
# class AdminModelChooserPanel(object):
#     def __init__(self, field_name):
#         self.field_name = field_name
# 
#     def bind_to_model(self, model):
#         return type(
#             str('_AdminModelChooserPanel'),
#             (BaseAdminModelChooserPanel,),
#             {
#                 'model': model,
#                 'field_name': self.field_name,
#             }
#         )
# 
# Path: modeladminutils/models.py
# class BaseSearchableManager(models.Manager):
#     def get_queryset(self):
# 
# Path: submissions/constants.py
# SECTIONS = (
#     (1, _('Fiction')),
#     (2, _('Animation')),
#     (3, _('Documentary')),
#     (4, _('Experimental')),
# )


from collections import defaultdict
from django.db import models
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailcore.models import Orderable, Page
from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel
from wagtail.wagtailsearch import index
from cpm_generic.models import TranslatedField
from modeladminutils.edit_handlers import AdminModelChooserPanel
from modeladminutils.models import SearchableManager
from submissions.constants import SECTIONS
    title = property(lambda self: self.film.title)
    director = property(lambda self: self.film.director)
    country = property(lambda self: self.film.country)
    city = property(lambda self: self.film.city)
    year = property(lambda self: self.film.year)
    duration = property(lambda self: self.film.duration)
    genre = property(lambda self: self.film.genre)
    synopsis_short = property(lambda self: self.film.synopsis_short)
    synopsis = property(lambda self: self.film.synopsis)
    frame = property(lambda self: self.film.frame)

    panels = [
        AdminModelChooserPanel('film'),
    ]


class FilmProgram(Page):

    # TODO: add season
    # TODO: need remove section as required property
    section = models.IntegerField(choices=SECTIONS)

    name_en = models.CharField(max_length=1000)
    name_be = models.CharField(max_length=1000)
    name_ru = models.CharField(max_length=1000)
    name = TranslatedField('name_en', 'name_be', 'name_ru')

    description_en = RichTextField(default='')
    description_be = RichTextField(default='')
    description_ru = RichTextField(default='')

# Path: cpm_generic/models.py
# class TranslatedField(object):
#     def __init__(self, en_field, be_field, ru_field):
#         self.en_field = en_field
#         self.be_field = be_field
#         self.ru_field = ru_field
# 
#     def __get__(self, instance, owner):
#         fields = {
#             'en': self.en_field,
#             'be': self.be_field,
#             'ru': self.ru_field,
#         }
#         field = fields.get(translation.get_language(), self.en_field)
#         return getattr(instance, field)
# 
# Path: modeladminutils/edit_handlers.py
# class AdminModelChooserPanel(object):
#     def __init__(self, field_name):
#         self.field_name = field_name
# 
#     def bind_to_model(self, model):
#         return type(
#             str('_AdminModelChooserPanel'),
#             (BaseAdminModelChooserPanel,),
#             {
#                 'model': model,
#                 'field_name': self.field_name,
#             }
#         )
# 
# Path: modeladminutils/models.py
# class BaseSearchableManager(models.Manager):
#     def get_queryset(self):
# 
# Path: submissions/constants.py
# SECTIONS = (
#     (1, _('Fiction')),
#     (2, _('Animation')),
#     (3, _('Documentary')),
#     (4, _('Experimental')),
# )


# Path: events/models.py
from collections import defaultdict
from django.db import models
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailcore.models import Orderable, Page
from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel
from wagtail.wagtailsearch import index
from cpm_generic.models import TranslatedField
from modeladminutils.edit_handlers import AdminModelChooserPanel
from modeladminutils.models import SearchableManager
from submissions.constants import SECTIONS

    title = property(lambda self: self.film.title)
    director = property(lambda self: self.film.director)
    country = property(lambda self: self.film.country)
    city = property(lambda self: self.film.city)
    year = property(lambda self: self.film.year)
    duration = property(lambda self: self.film.duration)
    genre = property(lambda self: self.film.genre)
    synopsis_short = property(lambda self: self.film.synopsis_short)
    synopsis = property(lambda self: self.film.synopsis)
    frame = property(lambda self: self.film.frame)

    panels = [
        AdminModelChooserPanel('film'),
    ]


class FilmProgram(Page):

    # TODO: add season
    # TODO: need remove section as required property
    section = models.IntegerField(choices=SECTIONS)

    name_en = models.CharField(max_length=1000)
    name_be = models.CharField(max_length=1000)
    name_ru = models.CharField(max_length=1000)
    name = TranslatedField('name_en', 'name_be', 'name_ru')

    description_en = RichTextField(default='')
    description_be = RichTextField(default='')
    description_ru = RichTextField(default='')

    description = TranslatedField('description_en',