Commit 1f0f08cc authored by Zenon Mousmoulas's avatar Zenon Mousmoulas

clean up

parent 06588684
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
<hr> <hr>
<form method="POST" class="form-horizontal"> <form method="POST" class="form-horizontal">
{% if form.non_field_errors %} {% if form.non_field_errors %}
{% for error in form.non_field_errors %} <ul>
<li class="alert-danger"><strong>{{ error }}</strong></li> {% for error in form.non_field_errors %}
{% endfor %} <li class="alert-danger"><strong>{{ error }}</strong></li>
{% endfor %}
</ul>
{% endif %} {% endif %}
{% csrf_token %} {% csrf_token %}
<div style="display: none"> <div style="display: none">
......
...@@ -240,7 +240,7 @@ class InstServer(models.Model): ...@@ -240,7 +240,7 @@ class InstServer(models.Model):
acct_port = models.PositiveIntegerField(max_length=5, null=True, blank=True, default=1813, help_text=_("Default for RADIUS: 1813")) acct_port = models.PositiveIntegerField(max_length=5, null=True, blank=True, default=1813, help_text=_("Default for RADIUS: 1813"))
status_server = models.BooleanField(help_text=_("Do you accept Status-Server requests?")) status_server = models.BooleanField(help_text=_("Do you accept Status-Server requests?"))
secret = models.CharField(max_length=80, ) secret = models.CharField(max_length=80)
proto = models.CharField(max_length=12, choices=RADPROTOS, default='radius') proto = models.CharField(max_length=12, choices=RADPROTOS, default='radius')
ts = models.DateTimeField(auto_now=True) ts = models.DateTimeField(auto_now=True)
...@@ -262,19 +262,18 @@ class InstServer(models.Model): ...@@ -262,19 +262,18 @@ class InstServer(models.Model):
return self.name return self.name
return self.host return self.host
# If a server is a proxy to a realm, # If a server is a proxy for a realm, can not change type to SP
# cannot change its type to SP
def clean(self): def clean(self):
if self.ertype == 2: if self.ertype == 2:
realms = InstRealm.objects.filter(proxyto=self) realms = InstRealm.objects.filter(proxyto=self)
if realms: if len(realms) > 0:
text = str() text = str()
for realm in realms: for realm in realms:
text = text + ' ' + realm.realm text = text + ' ' + realm.realm
raise ValidationError( raise ValidationError(
'You cannot change this server to SP (realms "' 'You cannot change this server to SP (it is used by realms %s)' %
+ text + '" use him as a proxy)' ', '.join([r.realm for r in realms])
) )
class InstRealmMon(models.Model): class InstRealmMon(models.Model):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment