本文整理汇总了Python中shuup.admin.toolbar.get_default_edit_toolbar函数的典型用法代码示例。如果您正苦于以下问题:Python get_default_edit_toolbar函数的具体用法?Python get_default_edit_toolbar怎么用?Python get_default_edit_toolbar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_default_edit_toolbar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_toolbar
def get_toolbar(self):
save_form_id = self.get_save_form_id()
obj = self.get_object()
delete_url = reverse_lazy("shuup_admin:task.delete", kwargs={"pk": obj.pk}) if obj.pk else None
toolbar = get_default_edit_toolbar(self, save_form_id, delete_url=delete_url)
if obj and obj.pk:
if obj.status == TaskStatus.NEW:
toolbar.append(
PostActionButton(
post_url=reverse_lazy("shuup_admin:task.set_status", kwargs=dict(pk=obj.pk)),
icon="fa fa-check",
name="status",
value=TaskStatus.IN_PROGRESS.value,
text=_("Set In Progress"),
extra_css_class="btn-success",
)
)
if obj.status == TaskStatus.IN_PROGRESS:
toolbar.append(
PostActionButton(
post_url=reverse_lazy("shuup_admin:task.set_status", kwargs=dict(pk=obj.pk)),
icon="fa fa-check",
name="status",
value=TaskStatus.COMPLETED.value,
text=_("Set Completed"),
extra_css_class="btn-success",
)
)
return toolbar
示例2: get_toolbar
def get_toolbar(self):
save_form_id = self.get_save_form_id()
if save_form_id:
delete_url = None
if self.object and self.object.pk:
delete_url = reverse_lazy("shuup_admin:xtheme_snippet.delete", kwargs={"pk": self.object.pk})
return get_default_edit_toolbar(self, save_form_id, delete_url=delete_url)
示例3: __init__
def __init__(self, view):
self.view = view
self.request = view.request
self.user = view.object
super(UserDetailToolbar, self).__init__()
self.extend(get_default_edit_toolbar(self.view, "user_form", with_split_save=False))
if self.user.pk:
self._build_existing_user()
示例4: get_toolbar
def get_toolbar(self):
toolbar = get_default_edit_toolbar(
self,
self.get_save_form_id(),
discard_url=(get_model_url(self.object) if self.object.pk else None)
)
# TODO: Add extensibility
return toolbar
示例5: get_toolbar
def get_toolbar(self):
toolbar = get_default_edit_toolbar(
self,
"permissions_form",
discard_url=get_model_url(self.object),
with_split_save=False
)
return toolbar
示例6: get_toolbar
def get_toolbar(self):
toolbar = get_default_edit_toolbar(self, self.get_save_form_id(), with_split_save=False)
toolbar.append(
URLActionButton(
text=_("Custom CSS/JS"),
icon="fa fa-magic",
url=reverse("shuup_admin:xtheme_snippet.list"),
extra_css_class="btn-info"
)
)
return toolbar
示例7: get_toolbar
def get_toolbar(self):
toolbar = get_default_edit_toolbar(
self,
self.get_save_form_id(),
discard_url=(get_model_url(self.object) if self.object.pk else None)
)
for button in get_provide_objects("admin_contact_edit_toolbar_button"):
toolbar.append(button(self.object))
return toolbar
示例8: __init__
def __init__(self, view):
super(EditProductToolbar, self).__init__()
self.view = view
self.request = view.request
self.product = view.object
self.extend(get_default_edit_toolbar(
self.view, "product_form",
delete_url="shuup_admin:product.delete"
))
if self.product.pk:
self._build_existing_product()
示例9: get_toolbar
def get_toolbar(self):
save_form_id = self.get_save_form_id()
object = self.get_object()
delete_url = reverse_lazy("shuup_admin:service_provider.delete", kwargs={"pk": object.pk})
toolbar = get_default_edit_toolbar(self, save_form_id, delete_url=delete_url)
if self.object.pk:
toolbar.append(URLActionButton(
text=_("Create {service_name}").format(
service_name=self.object.service_model._meta.verbose_name),
icon="fa fa-plus",
url="{model_url}?provider={id}".format(
model_url=get_model_url(self.object.service_model, "new"),
id=self.object.id),
extra_css_class="btn-info"
))
return toolbar
示例10: get_toolbar
def get_toolbar(self):
product_type = self.get_object()
save_form_id = self.get_save_form_id()
delete_url = reverse_lazy(
"shuup_admin:product_type.delete", kwargs={"pk": product_type.pk}
) if product_type.pk else None
toolbar = get_default_edit_toolbar(self, save_form_id)
if not delete_url:
return toolbar
toolbar.append(PostActionButton(
post_url=delete_url,
text=_(u"Delete"),
icon="fa fa-trash",
extra_css_class="btn-danger",
confirm=_("Are you sure you wish to delete %s? Warrning: all related products will disappear from storefront until new value for product type is set!") % product_type, # noqa
required_permissions=()
))
return toolbar
示例11: get_toolbar
def get_toolbar(self):
save_form_id = self.get_save_form_id()
object = self.get_object()
delete_url = reverse_lazy("shuup_admin:category.delete", kwargs={"pk": object.pk}) if object.pk else None
return get_default_edit_toolbar(self, save_form_id, delete_url=delete_url)
示例12: get_toolbar
def get_toolbar(self):
save_form_id = self.get_save_form_id()
return get_default_edit_toolbar(self, save_form_id, with_split_save=settings.SHUUP_ENABLE_MULTIPLE_SHOPS)
示例13: __init__
def __init__(self, view):
super(ProductParentBaseToolbar, self).__init__()
self.view = view
self.parent_product = view.object
self.request = view.request
get_default_edit_toolbar(self.view, "product_form", with_split_save=False, toolbar=self)
示例14: get_toolbar
def get_toolbar(self):
save_form_id = self.get_save_form_id()
if save_form_id:
return get_default_edit_toolbar(self, save_form_id)
示例15: get_toolbar
def get_toolbar(self):
object = self.get_object()
delete_url = (
reverse_lazy("shuup_admin:label.delete", kwargs={"pk": object.pk})
if object.pk else None)
return get_default_edit_toolbar(self, self.get_save_form_id(), delete_url=delete_url)