Skip to content

Commit

Permalink
[#1392] Added product finder plugin to products app
Browse files Browse the repository at this point in the history
  • Loading branch information
vaszig committed Apr 19, 2023
1 parent fc1df48 commit 4bc7285
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
15 changes: 14 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,8 @@
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool

from open_inwoner.pdc.models import Category
from open_inwoner.pdc.forms import ProductFinderForm
from open_inwoner.pdc.models import Category, ProductCondition


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


@plugin_pool.register_plugin
class ProductFinderPlugin(CMSPluginBase):
module = _("PDC")
name = _("Product Finder Plugin")
render_template = "cms/products/product_finder_plugin.html"

def render(self, context, instance, placeholder):
context["condition"] = ProductCondition.objects.first()
context["condition_form"] = ProductFinderForm()
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",
"ProductFinderPlugin",
],
"text_only_plugins": ["LinkPlugin"],
"name": _("Content"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% load i18n product_tags %}

{% if condition %}
{% product_finder condition=condition form=condition_form form_action="products:product_finder" primary_text=_("Start") %}
{% endif %}

0 comments on commit 4bc7285

Please sign in to comment.