0.4.0 projects

This commit is contained in:
SDE
2023-12-10 17:10:16 +03:00
parent c826f91145
commit ded9389d05
3 changed files with 19 additions and 10 deletions

View File

@@ -7,6 +7,9 @@ from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.fields import GenericRelation
from django.core.validators import validate_image_file_extension
from PortfolioApp.models import Project
class BlockPluginPresentation(Block_Abstract):
from BaseModels.base_models import Manager_Enabled
objects = models.Manager()
@@ -59,6 +62,12 @@ class Section(BaseModelViewPage):
related_query_name='grel_%(class)s_for_block_plugin_presentation')
def get_projects(self):
services_ids = self.rel_services_for_section.filter(enable=True).order_by('order').values_list('id', flat=True)
projects = Project.objects.filter(services__id=services_ids)
return projects
class Meta:
verbose_name = _('Раздел сайта')
verbose_name_plural = _('Разделы сайта')