Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
djnro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
itminedu
djnro
Commits
c0a7e245
Commit
c0a7e245
authored
Feb 15, 2016
by
Zenon Mousmoulas
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bugfix'
Fixes a logical issue that could be caused by editing InstServer properties
parents
c7a225e2
1f0f08cc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
djnro/templates/edumanage/servers_edit.html
djnro/templates/edumanage/servers_edit.html
+6
-4
edumanage/models.py
edumanage/models.py
+14
-0
No files found.
djnro/templates/edumanage/servers_edit.html
View file @
c0a7e245
...
...
@@ -9,12 +9,14 @@
<h4>
{% if edit %}{{form.instance.get_name}} ({% trans "edit" %}){% else %}{% trans "Add Server" %}{% endif %}
</h4>
<hr>
<form
method=
"POST"
class=
"form-horizontal"
>
{% csrf_token %}
{% if form.non_field_errors %}
<p
class=
"error"
>
{{ form.non_field_errors}}
</p>
<ul>
{% for error in form.non_field_errors %}
<li
class=
"alert-danger"
><strong>
{{ error }}
</strong></li>
{% endfor %}
</ul>
{% endif %}
{% csrf_token %}
<div
style=
"display: none"
>
{{form.instid}}
</div>
...
...
edumanage/models.py
View file @
c0a7e245
...
...
@@ -9,6 +9,7 @@ from django.core import exceptions
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django
import
forms
from
django.core.exceptions
import
ValidationError
class
MultiSelectFormField
(
forms
.
MultipleChoiceField
):
...
...
@@ -261,6 +262,19 @@ class InstServer(models.Model):
return
self
.
name
return
self
.
host
# If a server is a proxy for a realm, can not change type to SP
def
clean
(
self
):
if
self
.
ertype
==
2
:
realms
=
InstRealm
.
objects
.
filter
(
proxyto
=
self
)
if
len
(
realms
)
>
0
:
text
=
str
()
for
realm
in
realms
:
text
=
text
+
' '
+
realm
.
realm
raise
ValidationError
(
'You cannot change this server to SP (it is used by realms %s)'
%
', '
.
join
([
r
.
realm
for
r
in
realms
])
)
class
InstRealmMon
(
models
.
Model
):
'''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment