def post(self, *args, **kwargs): schema = self.get_object() if 'cancel' in self.request.POST: return redirect("coding schema-details", self.project.id, schema.id) # No, copy as requested new_schema = CodingSchema(name=self.request.POST.get("name"), description=schema.description, isarticleschema=schema.isarticleschema, subsentences=schema.subsentences, highlight_language=schema.highlight_language, project=self.project) new_schema.save() for field in schema.fields.all(): field.id = None field.codingschema = new_schema field.save() self.request.session["notification"] = ( "Copied coding schema. " "You can return to the overview using the 'Coding Schemas' link above" ) return redirect("coding schema-details", self.project.id, new_schema.id)
def name_schema(request, schema, project): """ User confirmed copying schema, ask for a name to give. """ if request.POST: if 'cancel' in request.POST: return redirect("project-schema", project.id, schema.id) # No, copy as requested new_schema = CodingSchema( name=request.POST.get("name"), description=schema.description, isnet=schema.isnet, isarticleschema=schema.isarticleschema, quasisentences=schema.quasisentences, project=project ) new_schema.save() for field in schema.fields.all(): field.id = None field.codingschema = new_schema field.save() request.session["schema_%s_is_new" % new_schema.id] = True return redirect("project-schema", project.id, new_schema.id) return table_view(request, project, None, 'codingschemas', template="navigator/project/name_schema.html", schema=schema)
def name_schema(request, schema, project): """ User confirmed copying schema, ask for a name to give. """ if request.POST: if 'cancel' in request.POST: return redirect("project-schema", project.id, schema.id) # No, copy as requested new_schema = CodingSchema(name=request.POST.get("name"), description=schema.description, isnet=schema.isnet, isarticleschema=schema.isarticleschema, quasisentences=schema.quasisentences, project=project) new_schema.save() for field in schema.fields.all(): field.id = None field.codingschema = new_schema field.save() request.session["schema_%s_is_new" % new_schema.id] = True return redirect("project-schema", project.id, new_schema.id) return table_view(request, project, None, 'codingschemas', template="navigator/project/name_schema.html", schema=schema)
def post(self, *args, **kwargs): schema = self.get_object() if 'cancel' in self.request.POST: return redirect("navigator:codingschema-details", self.project.id, schema.id) # No, copy as requested new_schema = CodingSchema( name=self.request.POST.get("name"), description=schema.description, isarticleschema=schema.isarticleschema, subsentences=schema.subsentences, highlight_language=schema.highlight_language, project=self.project ) new_schema.save() for field in schema.fields.all(): field.id = None field.codingschema = new_schema field.save() self.request.session["notification"] = ("Copied codingschema. " "You can return to the overview using the 'Coding Schemas' link above") return redirect("navigator:codingschema-details", self.project.id, new_schema.id)