-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #657 from awesto/cancel-order-with-refund
Cancel order with refund
- Loading branch information
Showing
26 changed files
with
316 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.utils.translation import ugettext_lazy as _ | ||
from cms.plugin_pool import plugin_pool | ||
from cmsplugin_cascade.plugin_base import TransparentContainer | ||
|
||
from .plugin_base import ShopPluginBase | ||
|
||
|
||
class ShopExtendableMixin(object): | ||
""" | ||
Add this mixin class to the list of ``model_mixins``, in the plugin class wishing to use extensions. | ||
""" | ||
@property | ||
def left_extension(self): | ||
result = [cp for cp in self.child_plugin_instances if cp.plugin_type == 'ShopLeftExtension'] | ||
if result: | ||
return result[0] | ||
|
||
@property | ||
def right_extension(self): | ||
result = [cp for cp in self.child_plugin_instances if cp.plugin_type == 'ShopRightExtension'] | ||
if result: | ||
return result[0] | ||
|
||
|
||
class LeftRightExtensionMixin(object): | ||
""" | ||
Plugin classes wishing to use extensions shall inherit from this class. | ||
""" | ||
@classmethod | ||
def get_child_classes(cls, slot, page, instance=None): | ||
child_classes = ['ShopLeftExtension', 'ShopRightExtension', None] | ||
# allow only one left and one right extension | ||
for child in instance.get_children(): | ||
child_classes.remove(child.plugin_type) | ||
return child_classes | ||
|
||
|
||
class ShopLeftExtension(TransparentContainer, ShopPluginBase): | ||
name = _("Left Extension") | ||
require_parent = True | ||
parent_classes = ('ShopCartPlugin', 'ShopOrderViewsPlugin') | ||
allow_children = True | ||
render_template = 'cascade/generic/naked.html' | ||
|
||
plugin_pool.register_plugin(ShopLeftExtension) | ||
|
||
|
||
class ShopRightExtension(TransparentContainer, ShopPluginBase): | ||
name = _("Right Extension") | ||
require_parent = True | ||
parent_classes = ('ShopCartPlugin', 'ShopOrderViewsPlugin') | ||
allow_children = True | ||
render_template = 'cascade/generic/naked.html' | ||
|
||
plugin_pool.register_plugin(ShopRightExtension) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.