from django.db import models
from BaseModels.base_models import BaseModelViewPage, BaseModel, validate_file_extension
from django.utils.translation import gettext_lazy as _
# from ckeditor.fields import RichTextField
from ckeditor_uploader.fields import RichTextUploadingField
# from colorfield.fields import ColorField
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.fields import GenericRelation
from colorfield.fields import ColorField


class Project(BaseModelViewPage):
    from ServicesApp.models import Service
    services = models.ManyToManyField(
        Service, verbose_name=_('Услуги которые использовались для реализации'),
        blank=True, related_name='rel_projects_for_service'
    )

    def get_services(self):
        services = self.services.filter(enable=True).order_by('order')
        return services

    class Meta:
        verbose_name = _('Проект')
        verbose_name_plural = _('Проекты')

