diff --git a/models.py b/models.py index 7430a5e..f5482bf 100644 --- a/models.py +++ b/models.py @@ -103,9 +103,11 @@ class Season: try: end = datetime.date.fromisoformat(end) except Exception: - raise INVALID_STR.format('end') + raise AttributeError(INVALID_STR.format('end')) code = form.get('code', None) + if not code: + raise AttributeError(INVALID_STR.format('code')) self = cls(id, game, description, start, end, code) return self diff --git a/schema.sql b/schema.sql index dfb73c6..2c9b603 100644 --- a/schema.sql +++ b/schema.sql @@ -7,7 +7,7 @@ create table if not exists season description text, start text, end text, - code text + code text not null ); create unique index if not exists season_id_uindex diff --git a/templates/editseason.html b/templates/editseason.html index 1c5f3f1..babd98b 100644 --- a/templates/editseason.html +++ b/templates/editseason.html @@ -20,7 +20,8 @@ type="text" class="form-control" id="code" - value="{{ model['code'] }}"> + value="{{ model['code'] }}" + required>