Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
44 lines (33 sloc) 1.07 KB

Custom Modules

Example of a simple javascript widget module that is powered from provided Partner IDs


Python that is run when rendering the module using the provided Site and module options

from dhplatform.modules.base import BaseModule

class Module(BaseModule):
    @widget_type options:
    - current_coupon
    - list_of_offers

    widget_type = ModuleProperty(str, 'current_coupon')

    def run(self):
        # generate the url using the Widget Type and Customer Site ID
        # that will be passed in to render the widget
        widget_url = "" % (
  ['partner_site_id'], # partner provided ID for customer or site

        return {
            'widget_url': widget_url,


HTML that is rendered into the Site

<div class="box"><div class="box-inner">
    <div class="embed">
        <script type="text/javascript" src="{{ widget_url }}"></script>