10000 Merge pull request #41 from dongweiming/bugfix_when_project_has_exists · lcppcl/code@e679f4b · GitHub
[go: up one dir, main page]

Skip to content

Commit e679f4b

Browse files
committed
Merge pull request douban#41 from dongweiming/bugfix_when_project_has_exists
Bugfix: Create project but project has exists
2 parents eb05a81 + 5cb0e3f commit e679f4b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

vilya/templates/errors/common.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<%inherit file="/layouts/base.html" />
2+
3+
<div style="text-align: center;">
4+
<p>"${error}"</p>
5+
</div>

vilya/views/projects/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ def _q_index(request):
2424
creator_id=current_user.id)
2525
if p:
2626
return request.redirect('%s' % p.repo_name)
27-
context['project'] = p
28-
return st('projects/index.html', **context)
27+
has_proj = Project.get_by_name_and_owner(name, current_user.id)
28+
default_error = 'Create Failure. Please contact the administrator!'
29+
if has_proj is not None:
30+
context['error'] = 'Project has exists, Please confirm!'
31+
else:
32+
context['error'] = default_error
33+
context['current_user'] = current_user
34+
return st('/errors/common.html', **context)
35+
2936
projects = Project.gets_by()
3037
context['projects'] = projects
3138
context['current_user'] = current_user

0 commit comments

Comments
 (0)
0