def delete_app(request, domain, app_id): "Deletes an app from the database" app = get_app(domain, app_id) record = app.delete_app() messages.success( request, _('You have deleted an application. <a href="%s" class="post-link">Undo</a>' ) % reverse('undo_delete_app', args=[domain, record.get_id]), extra_tags='html') app.save() clear_app_cache(request, domain) clear_xmlns_app_id_cache(domain) return HttpResponseRedirect( reverse(DomainDashboardView.urlname, args=[domain]))
def delete_app(request, domain, app_id): "Deletes an app from the database" app = get_app(domain, app_id) record = app.delete_app() messages.success( request, _('You have deleted an application. <a href="%s" class="post-link">Undo</a>') % reverse('undo_delete_app', args=[domain, record.get_id]), extra_tags='html' ) app.save() clear_app_cache(request, domain) clear_xmlns_app_id_cache(domain) return HttpResponseRedirect(reverse(DomainDashboardView.urlname, args=[domain]))
def delete_module(request, domain, app_id, module_unique_id): "Deletes a module from an app" app = get_app(domain, app_id) try: record = app.delete_module(module_unique_id) except ModuleNotFoundException: return bail(request, domain, app_id) if record is not None: messages.success( request, 'You have deleted "%s". <a href="%s" class="post-link">Undo</a>' % (record.module.default_name(app=app), reverse('undo_delete_module', args=[domain, record.get_id])), extra_tags='html') app.save() clear_xmlns_app_id_cache(domain) return back_to_main(request, domain, app_id=app_id)
def delete_module(request, domain, app_id, module_unique_id): "Deletes a module from an app" app = get_app(domain, app_id) try: record = app.delete_module(module_unique_id) except ModuleNotFoundException: return bail(request, domain, app_id) if record is not None: messages.success( request, 'You have deleted "%s". <a href="%s" class="post-link">Undo</a>' % ( record.module.default_name(app=app), reverse('undo_delete_module', args=[domain, record.get_id]) ), extra_tags='html' ) app.save() clear_xmlns_app_id_cache(domain) return back_to_main(request, domain, app_id=app_id)
def delete_form(request, domain, app_id, module_unique_id, form_unique_id): "Deletes a form from an app" app = get_app(domain, app_id) record = app.delete_form(module_unique_id, form_unique_id) if record is not None: messages.success( request, 'You have deleted a form. <a href="%s" class="post-link">Undo</a>' % reverse('undo_delete_form', args=[domain, record.get_id]), extra_tags='html') app.save() clear_xmlns_app_id_cache(domain) try: module_id = app.get_module_by_unique_id(module_unique_id).id except ModuleNotFoundException as e: messages.error(request, six.text_type(e)) module_id = None return back_to_main(request, domain, app_id=app_id, module_id=module_id)
def delete_form(request, domain, app_id, module_unique_id, form_unique_id): "Deletes a form from an app" app = get_app(domain, app_id) record = app.delete_form(module_unique_id, form_unique_id) if record is not None: messages.success( request, 'You have deleted a form. <a href="%s" class="post-link">Undo</a>' % reverse('undo_delete_form', args=[domain, record.get_id]), extra_tags='html' ) app.save() clear_xmlns_app_id_cache(domain) try: module_id = app.get_module_by_unique_id(module_unique_id).id except ModuleNotFoundException as e: messages.error(request, six.text_type(e)) module_id = None return back_to_main(request, domain, app_id=app_id, module_id=module_id)