# Path: cloudkittydashboard/api/cloudkitty.py
# def cloudkittyclient(request):
# def identify(what, name=False, key=None):


from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
from cloudkittydashboard.api import cloudkitty as api
    icon = "pencil"

    def get_link_url(self, datum=None):
        url = "horizon:admin:pyscripts:script_update"
        return reverse(url, kwargs={'script_id': datum.script_id})


class DeletePyScript(tables.DeleteAction):
    name = "deletepyscript"
    verbose_name = _("Delete Script")
    data_type_singular = _("PyScript")
    data_type_plural = _("PyScripts")

    @staticmethod
    def action_present(count):
        return ungettext_lazy(
            u"Delete PyScript",
            u"Delete PyScripts",
            count
        )

    @staticmethod
    def action_past(count):
        return ungettext_lazy(
            u"Deleted PyScript",
            u"Deleted PyScripts",
            count
        )

    def action(self, request, script_id):

# Path: cloudkittydashboard/api/cloudkitty.py
# def cloudkittyclient(request):
# def identify(what, name=False, key=None):


# Path: cloudkittydashboard/dashboards/admin/pyscripts/tables.py
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
from cloudkittydashboard.api import cloudkitty as api

    icon = "pencil"

    def get_link_url(self, datum=None):
        url = "horizon:admin:pyscripts:script_update"
        return reverse(url, kwargs={'script_id': datum.script_id})


class DeletePyScript(tables.DeleteAction):
    name = "deletepyscript"
    verbose_name = _("Delete Script")
    data_type_singular = _("PyScript")
    data_type_plural = _("PyScripts")

    @staticmethod
    def action_present(count):
        return ungettext_lazy(
            u"Delete PyScript",
            u"Delete PyScripts",
            count
        )

    @staticmethod
    def action_past(count):
        return ungettext_lazy(
            u"Deleted PyScript",
            u"Deleted PyScripts",
            count
        )

    def action(self, request, script_id):

        api.cloudkittyclient(request).rating.pyscripts.delete_script(