From 8e5caa92dba12e8f0976443124d3438ff72ef628 Mon Sep 17 00:00:00 2001 From: wrmswindmill Date: Sun, 16 Sep 2018 15:01:23 +0800 Subject: [PATCH] fix --- apps/operations/views.py | 4 ++++ apps/projects/views.py | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/operations/views.py b/apps/operations/views.py index 8fd55f8..1528bef 100644 --- a/apps/operations/views.py +++ b/apps/operations/views.py @@ -1213,6 +1213,10 @@ def get_url_mapping_project(url): filename = url[index+1:-1] path_origin = path else: + para_index = url.rfind("?") + if para_index != -1: + url = url[:para_index] + index_special = url.rfind("#") path_origin = url[index1:] if index_special == -1: diff --git a/apps/projects/views.py b/apps/projects/views.py index ed5303f..1bd2c9f 100644 --- a/apps/projects/views.py +++ b/apps/projects/views.py @@ -179,12 +179,14 @@ class ProjectSourceView(View): response = json.loads(response.text) email = response['email'] exist_records = User.objects.filter(email=email).first() + print(email) + pass_word = "init_password" if not exist_records: + print(exist_records) user = User() user.username = response['username'] while User.objects.filter(username=user.username).first(): user.username += str(random.randint(0,10)) - pass_word = "init_password" user.password = make_password(pass_word) user.password_codepedia = user.password user.educoder_userid = int(educoder_userid) @@ -206,10 +208,11 @@ class ProjectSourceView(View): def get(self, request, name, path): educoder_userid = request.GET.get("eid","") - print("educoder_userid:"+educoder_userid) if educoder_userid!="": self.login_educoder(educoder_userid,request) - project = Project.objects.filter(name=name).first() + name = name.split("?")[0] + path = path.split("?")[0] + project = Project.objects.filter(name=name).first() project_tree = projectTreeObj.get_project_tree_by_projectid(project.id) return render(request, 'projects/source.html', locals())