Skip to content

Commit

Permalink
Use html "pattern" and "required" attributes for validation
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Dec 9, 2024
1 parent 061e672 commit 855c7fb
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions apis_ontology/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,27 +176,48 @@ class Person(
"title": "Alternative Names",
"type": "array",
"format": "table",
"required": ["name"],
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"pattern": "^.+$",
"options": {
"inputAttributes": {
"required": True,
},
},
},
"art": {"type": "string", "enum": ["", "Ehename", "Pseudonym"]},
"start": {
"type": "string",
"format": "date",
"pattern": "^$|^\d\d\d\d$",
"options": {
"inputAttributes": {
"placeholder": "YYYY",
},
"containerAttributes": {
"class": "yearinput",
}
},
},
"end": {
"type": "string",
"format": "date",
"pattern": "^$|^\d\d\d\d$",
"options": {
"inputAttributes": {
"placeholder": "YYYY",
},
"containerAttributes": {
"class": "yearinput",
}
},
},
},
},
}

alternative_names = JSONEditorField(schema=schema, null=True)
alternative_names = JSONEditorField(schema=schema)

# texts
# "ÖBL Haupttext"
Expand Down

0 comments on commit 855c7fb

Please sign in to comment.