Skip to content

Commit

Permalink
[#1393] Added product locations plugin to products app
Browse files Browse the repository at this point in the history
  • Loading branch information
vaszig committed Apr 24, 2023
1 parent d60b7b0 commit 186a7ac
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/open_inwoner/cms/products/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool

from open_inwoner.pdc.models import Category
from open_inwoner.pdc.models import Category, ProductLocation


@plugin_pool.register_plugin
Expand All @@ -20,3 +20,14 @@ def render(self, context, instance, placeholder):
0 : self.limit
]
return context


@plugin_pool.register_plugin
class ProductLocationPlugin(CMSPluginBase):
module = _("PDC")
name = _("Product Location Plugin")
render_template = "cms/products/product_location_plugin.html"

def render(self, context, instance, placeholder):
context["product_locations"] = ProductLocation.objects.all()[:1000]
return context
1 change: 1 addition & 0 deletions src/open_inwoner/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@
"PicturePlugin",
"CategoriesPlugin",
"ActivePlansPlugin",
"ProductLocationPlugin",
],
"text_only_plugins": ["LinkPlugin"],
"name": _("Content"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% load i18n map_tags %}

<h2 class="h2">{{configurable_text.home_page.home_map_title}}</h2>
<p class="p">{{configurable_text.home_page.home_map_intro|linebreaksbr}}</p>

{% with centroid=product_locations.get_centroid %}
{% map centroid.lat centroid.lng geojson_feature_collection=product_locations.get_geojson_feature_collection %}
{% endwith %}

0 comments on commit 186a7ac

Please sign in to comment.