def ready(self): from payments.signals import status_changed from froide.account import ( account_canceled, account_merged ) from froide.account.export import registry from froide_payment.signals import subscription_canceled from .listeners import ( payment_status_changed, subscription_was_canceled, cancel_user, merge_user, export_user_data ) status_changed.connect(payment_status_changed) subscription_canceled.connect(subscription_was_canceled) account_canceled.connect(cancel_user) account_merged.connect(merge_user) registry.register(export_user_data) from froide.account.menu import menu_registry, MenuItem def get_donation_menu_item(request): return MenuItem( section='before_settings', order=999, url=reverse_lazy('fds_donation:donor-user'), label=_('My donations') ) menu_registry.register(get_donation_menu_item)
def connect_signals(self): from .models import Payment from .receivers import (auto_radius_groups_on_plan_creation, auto_radius_groups_on_org_creation, auto_rename_radius_groups) from plans.models import PlanPricing, Plan from openwisp_users.models import Organization status_changed.connect(Payment.payment_status_changed) post_save.connect(auto_radius_groups_on_plan_creation, sender=PlanPricing) post_save.connect(auto_radius_groups_on_org_creation, sender=Organization) pre_save.connect(auto_rename_radius_groups, sender=Plan)
def ready(self): # TODO: add export, cancel and merging user hooks from payments.signals import status_changed from froide.account.menu import menu_registry, MenuItem from .listeners import payment_status_changed status_changed.connect(payment_status_changed) @menu_registry.register def get_campaign_menu_item(request): if not request.user.is_staff: return None try: return MenuItem(section='before_settings', order=10, url=reverse('crowdfunding:crowdfunding-edit'), label=_('Your crowdfundings')) except NoReverseMatch: return None
def ready(self): # TODO: add export, cancel and merging user hooks from payments.signals import status_changed from froide.account.menu import menu_registry, MenuItem from . import contribution_successful from .listeners import (payment_status_changed, send_contribution_notification) status_changed.connect(payment_status_changed) contribution_successful.connect(send_contribution_notification) @menu_registry.register def get_crowdfunding_menu_item(request): if not request.user.has_perm('froide_crowdfunding.can_crowdfund'): return None try: return MenuItem(section='before_settings', order=10, url=reverse('crowdfunding:crowdfunding-edit'), label=_('Your crowdfundings')) except NoReverseMatch: return None
def ready(self): from payments.signals import status_changed from .signals import order_status_change status_changed.connect(order_status_change)
def ready(self): from payments.signals import status_changed from .signals import order_status_change status_changed.connect(order_status_change)
def ready(self): from payments.signals import status_changed from .listeners import subscription_payment status_changed.connect(subscription_payment)