def tp_admin_files(request, translation_project): queryset = translation_project.stores.all() try: template_translation_project = TranslationProject.objects.get(project=translation_project.project, language__code='templates') if 'template_update' in request.GET: convert_templates(template_translation_project, translation_project) except TranslationProject.DoesNotExist: pass if 'scan_files' in request.GET: scan_translation_project_files(translation_project) for store in translation_project.stores.exclude(file='').iterator(): store.sync(update_translation=True) store.update(update_structure=True, update_translation=True, conservative=False) model_args = { 'title': _("Files"), 'submitname': "changestores", 'formid': "stores", 'navitems': [navbar_dict.make_directory_navbar_dict(request, translation_project.directory)], 'feed_path': translation_project.directory.pootle_path[1:], 'translation_project': translation_project, 'language': translation_project.language, 'project': translation_project.project, 'directory': translation_project.directory, } link = "%s/translate/" return util.edit(request, 'translation_project/tp_admin_files.html', Store, model_args, link, linkfield='pootle_path', queryset=queryset, formset=StoreFormset, can_delete=True, extra=0)
def process_extra_fields(self): if self.instance.pk is not None: if self.cleaned_data.get('initialize', None): self.instance.initialize() if self.cleaned_data.get('update', None): project_tree.convert_templates(template_translation_project, self.instance)