UPD: more cool participant admin stuff.

This commit is contained in:
2019-06-04 15:54:13 +02:00
parent 9104d69dd7
commit 61605a205c
9 changed files with 258 additions and 85 deletions

View File

@@ -140,4 +140,11 @@ thead input {
content:"*";
color: red;
}
*/
*/
/*
* Used to remove the space around link like buttons (<button class="btn btn-link no-padding">).
*/
.no-padding {
padding: 0px;
}

View File

@@ -0,0 +1,37 @@
from django.test import SimpleTestCase
from .generic import ValidatorTestMixin
from ..validators import DAVNumberValidator
class DAVNumberValidatorTestCase(ValidatorTestMixin, SimpleTestCase):
validator = DAVNumberValidator
def test_valid_data(self):
data = (
'131/00/1',
'1',
'22',
'333',
'1/22/22',
'54321/54321/54321*54321',
'54321/54321/54321*54321*4321*4321',
'54321/54321/54321*54321*4321*4321*87654321',
'54321*54321',
'54321*54321*4321*4321',
'54321*54321*4321*4321*87654321',
)
self.assertValid(self.validator, data)
def test_invalid_data(self):
data = (
'131/00/',
'1/1/1',
'1/1',
'abc',
'131/00/abc',
'abc/00/131',
'131/ab/131',
)
self.assertInvalid(self.validator, data)

13
dav_base/validators.py Normal file
View File

@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
from django.core.validators import RegexValidator
from django.utils.translation import ugettext_lazy as _
DAVNumberValidator = RegexValidator(r'^'
r'([0-9]{1,10}/[0-9]{2,10}/)?'
r'[0-9]{1,10}'
r'(\*[0-9]{1,10})?'
r'(\*[0-9]{4}\*[0-9]{4})?'
r'([* ][0-9]{8})?'
r'$',
_(u'Ungültiges Format.'))