def import_file(request): if request.method=="POST": form = ImportTableForm(request.POST, request.FILES) if form.is_valid(): app_label = request.POST.get("app_name") model_name = request.POST.get("model_name") import_table_file(model=get_model(app_label, model_name), scheme=TABLE_EXPORTS_IMPORTS_SCHEME[app_label][model_name], file=request.FILES['file']) return HttpResponseRedirect(reverse("table_export_list"))
def exports_list(request): return render_to_response("exports_list.html", {"models":[(model._meta.verbose_name_plural, (model._meta.app_label, model.__name__), model, ImportTableForm.from_model(model)) for model in _get_model_list()]})