def get_toolbar(self): if self.request.user.is_superuser: settings_button = SettingsActionButton.for_model( Contact, return_url="contact") else: settings_button = None return Toolbar([ NewActionButton.for_model(PersonContact, url=reverse("wshop_admin:contact.new") + "?type=person"), NewActionButton.for_model(CompanyContact, extra_css_class="btn-info", url=reverse("wshop_admin:contact.new") + "?type=company"), settings_button ])
def get_context_data(self, **kwargs): context = super(AddonListView, self).get_context_data(**kwargs) context["toolbar"] = Toolbar([ PostActionButton( icon="fa fa-save", form_id="addon_list", text=_("Save addon changes"), extra_css_class="btn-success", ), NewActionButton( reverse("wshop_admin:addon.upload"), text=_("Upload new addon"), extra_css_class="btn-info", icon="fa fa-upload", ) ]) if self.request.GET.get("reload"): context["toolbar"].append( URLActionButton( reverse("wshop_admin:addon.reload"), text=_("Reload application"), extra_css_class="btn-warning", icon="fa fa-refresh", )) return context
def get_context_data(self, **kwargs): context = super(ContactGroupListView, self).get_context_data(**kwargs) if self.request.user.is_superuser: settings_button = SettingsActionButton.for_model( ContactGroup, return_url="contact_group") else: settings_button = None context["toolbar"] = Toolbar([ NewActionButton("wshop_admin:contact_group.new"), settings_button ]) return context
def get_context_data(self, **kwargs): context = super(PermissionGroupListView, self).get_context_data(**kwargs) context["title"] = _("Permission Groups") if self.request.user.is_superuser: settings_button = SettingsActionButton.for_model(self.model, return_url="permission_group") else: settings_button = None context["toolbar"] = Toolbar([ NewActionButton("wshop_admin:permission_group.new", text=_("Create new Permission Group")), settings_button ]) return context
def get_context_data(self, **kwargs): context = super(CouponListView, self).get_context_data(**kwargs) if self.request.user.is_superuser: settings_button = SettingsActionButton.for_model( self.model, return_url="coupon") else: settings_button = None context["toolbar"] = Toolbar([ NewActionButton("wshop_admin:coupon.new", text=_("Create new Coupon")), settings_button ]) return context
def get_toolbar(self): buttons = [] model = self.model if hasattr(self, "get_model"): model = self.get_model() new_button = NewActionButton.for_model(model) if new_button: buttons.append(new_button) return_url = self.url_identifier if self.url_identifier else None if self.request.user.is_superuser: settings_button = SettingsActionButton.for_model( model, return_url=return_url) else: settings_button = None if settings_button: buttons.append(settings_button) return Toolbar(buttons)
def get_toolbar(self): return Toolbar([ NewActionButton.for_model(Order, url=reverse("wshop_admin:order.new")), SettingsActionButton.for_model(Order, return_url="order") ])