Esempio n. 1
0
def handle_tp_data_update(**kwargs):
    tp = kwargs["instance"]
    if "object_list" in kwargs:
        data_updater.get(TranslationProject)(
            tp, object_list=kwargs["object_list"]).update()
    else:
        data_tool.get(TranslationProject)(tp).update()
Esempio n. 2
0
    def get_data(self):
        context = super(ProjectsData, self).get_data()
        context["data"]["languages"] = LanguageSearch(
            user=self.user,
            fields=["code"],
            flat=True).data
        context["data"]["projects"] = OrderedDict(
            ProjectSearch(
                user=self.user,
                fields=["code", "text"]).data)

        schema = [
            "code", "name", "disabled", "critical", "total",
            "fuzzy", "translated", "suggestions"]

        context["data"]["__schema__"].update(dict(children=schema))
        user_projects = (
            Project.objects.for_user(self.user)
                           .select_related("directory"))
        project_set = ProjectSet(user_projects)
        stats = data_tool.get(ProjectSet)(project_set).get_stats()["children"]
        items = []
        for item in context["data"]["projects"].items():
            item = item + (False, )
            if item[0] in stats:
                for k in schema[3:]:
                    item += (stats[item[0]][k], )
            items.append(item)
        context["data"]["children"] = items

        if self.page:
            context["site_languages"] = self.site_languages
        return context
Esempio n. 3
0
 def data_tool(self):
     return data_tool.get(self.__class__)(self)
Esempio n. 4
0
def handle_store_data_update(**kwargs):
    store = kwargs.get("instance")
    data_tool.get(Store)(store).update()