Skip to content

Commit ee39fd1

Browse files
committed
Bugfix: Create project but project has exists
1 parent e97e99e commit ee39fd1

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
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: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def __call__(request):
1313

1414

1515
def _q_index(request):
16-
context = {}
1716
current_user = request.user
1817
if current_user and request.method == "POST":
1918
name = request.get_form_var('name')
@@ -24,12 +23,14 @@ def _q_index(request):
2423
creator_id=current_user.id)
2524
if p:
2625
return request.redirect('projects/%s' % p.name)
27-
context['project'] = p
28-
return st('projects/index.html', **context)
26+
has_proj = Project.get_by_name_and_owner(name, current_user.id)
27+
error = 'Create Failure. Please contact the administrator!'
28+
if has_proj is not None:
29+
error = 'Project has exists, Please confirm!'
30+
return st('/errors/common.html', **locals())
31+
2932
projects = Project.gets_by()
30-
context['projects'] = projects
31-
context['current_user'] = current_user
32-
return st('projects/index.html', **context)
33+
return st('projects/index.html', **locals())
3334

3435

3536
def _q_lookup(request, part):

0 commit comments

Comments
 (0)