diff --git a/nsupdate/main/migrations/0011_auto_20170526_2113.py b/nsupdate/main/migrations/0011_auto_20170526_2113.py new file mode 100644 index 0000000..f7721bd --- /dev/null +++ b/nsupdate/main/migrations/0011_auto_20170526_2113.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import django.core.validators + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0010_auto_20151229_1717'), + ] + + operations = [ + migrations.AlterField( + model_name='domain', + name='name', + field=models.CharField(help_text='Name of the zone where dynamic hosts may get added', unique=True, max_length=255, verbose_name='name', validators=[django.core.validators.RegexValidator(regex=b'([a-zA-Z0-9-_]+\\.)+[a-zA-Z0-9-_]{2,}', message='Invalid domain name')]), + ), + ] diff --git a/nsupdate/main/models.py b/nsupdate/main/models.py index 1a3fcef..57930c7 100644 --- a/nsupdate/main/models.py +++ b/nsupdate/main/models.py @@ -85,6 +85,7 @@ class Domain(models.Model): name = models.CharField( _("name"), max_length=255, # RFC 2181 (and also: max length of unique fields) + validators=[RegexValidator(regex=r"([a-zA-Z0-9-_]+\.)+[a-zA-Z0-9-_]{2,}", message=_("Invalid domain name"))], unique=True, help_text=_("Name of the zone where dynamic hosts may get added")) nameserver_ip = models.GenericIPAddressField( diff --git a/nsupdate/main/templates/main/domain_add.html b/nsupdate/main/templates/main/domain_add.html index e417afe..e870926 100644 --- a/nsupdate/main/templates/main/domain_add.html +++ b/nsupdate/main/templates/main/domain_add.html @@ -2,6 +2,11 @@ {% load i18n %}{% load bootstrap %} {% block content %} +
- {% blocktrans trimmed %} - Here you can add new domains (zones) which you control (and this is only useful if you - have some own zone which you can update automatically). - {% endblocktrans %} + {% blocktrans trimmed %} + Here you can add new domains (zones) which you control (and this is only + useful if you + have some own zone which you can update automatically). + {% endblocktrans %}
- {% blocktrans trimmed %} - You need to be able to configure the primary master nameserver of the zone so it accepts - dynamic updates (via RFC 2136 "dynamic update" protocol) if the correct update secret is presented. - {% endblocktrans %} + {% blocktrans trimmed %} + You need to be able to configure the primary master nameserver of the zone + so it accepts + dynamic updates (via RFC 2136 "dynamic update" protocol) if the correct + update secret is presented. + {% endblocktrans %}
- {% trans "We'll show you configuration examples after you add a domain." %} + {% trans "We'll show you configuration examples after you add a domain." %}