diff --git a/GeneralApp/migrations/0023_alter_block_block_type.py b/GeneralApp/migrations/0023_alter_block_block_type.py new file mode 100644 index 0000000..c13b365 --- /dev/null +++ b/GeneralApp/migrations/0023_alter_block_block_type.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.7 on 2023-12-10 17:16 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('GeneralApp', '0022_alter_office_work_time_from_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='block', + name='block_type', + field=models.CharField(choices=[('photo_n_text', 'Фото с одной стороны + Текст с другой стороны'), ('main_block_w_subblocks', 'Блок с подблоками'), ('present_technology_block', 'описание и НАЗВАНИЕ слева + Картинка справа'), ('photo150_n_title', 'Фото 150x150 сверху + заголовок под фото'), ('how_work', 'Как с нами работать'), ('how_dev', 'Как ведется разработка'), ('feedback_form', 'Форма обратной связи'), ('projects_block', 'Блок проектов')], default='photo_n_text', max_length=100, verbose_name='Тип блока'), + ), + ] diff --git a/PortfolioApp/models.py b/PortfolioApp/models.py index a659483..d812423 100644 --- a/PortfolioApp/models.py +++ b/PortfolioApp/models.py @@ -18,7 +18,7 @@ class Project(BaseModelViewPage): ) def get_services(self): - services = self.services.filter(enable=True).order_by('order') + services = self.services.filter(enabled=True).order_by('order') return services class Meta: diff --git a/ServicesApp/models.py b/ServicesApp/models.py index 4dce95b..593cc06 100644 --- a/ServicesApp/models.py +++ b/ServicesApp/models.py @@ -7,7 +7,6 @@ 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): @@ -63,6 +62,7 @@ class Section(BaseModelViewPage): def get_projects(self): + from PortfolioApp.models import Project 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