mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-23 01:06:31 -06:00
Fixes #1136 - do not to allow create a server group with same name.
This commit is contained in:
parent
42a3b784ba
commit
c81977d441
@ -198,6 +198,18 @@ class ServerGroupView(NodeView):
|
||||
data = request.form if request.form else json.loads(request.data.decode())
|
||||
if data[u'name'] != '':
|
||||
try:
|
||||
check_sg = ServerGroup.query.filter_by(
|
||||
user_id=current_user.id,
|
||||
name=data[u'name']).first()
|
||||
|
||||
# Throw error if server group already exists...
|
||||
if check_sg is not None:
|
||||
return make_json_response(
|
||||
status=409,
|
||||
success=0,
|
||||
errormsg=gettext('Server group already exists')
|
||||
)
|
||||
|
||||
sg = ServerGroup(
|
||||
user_id=current_user.id,
|
||||
name=data[u'name'])
|
||||
|
Loading…
Reference in New Issue
Block a user