0.4.0 projects
This commit is contained in:
@@ -29,6 +29,7 @@ block_type_choices = (
|
||||
('how_work', _('Как с нами работать')),
|
||||
('how_dev', _('Как ведется разработка')),
|
||||
('feedback_form', _('Форма обратной связи')),
|
||||
('projects_block', _('Блок проектов')),
|
||||
# ('slider', _('Галерея слайдов')),
|
||||
)
|
||||
|
||||
|
||||
@@ -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 = _('Разделы сайта')
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<div>
|
||||
{% for project in page.get_projects %}
|
||||
<div>
|
||||
{{ project.name }}
|
||||
{{ project.description|safe|linebreaksbr }}
|
||||
<img src="{{ MEDIA_URL }}{{ project.picture }}" alt="{{ project.name }}" />
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
Reference in New Issue
Block a user