-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BE: Fix period at end of pref. name being rejected (#509)
- Loading branch information
Showing
3 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
backend/projectify/user/migrations/0015_remove_user_preferred_name_user_preferred_name.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
# | ||
# Copyright (C) 2024 JWP Consulting GK | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published | ||
# by the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
"""Allow for user preferred names to end on period or colon.""" | ||
# Generated by Django 5.0.3 on 2024-05-24 12:45 | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
"""Migration.""" | ||
|
||
dependencies = [ | ||
("auth", "0012_alter_user_first_name_max_length"), | ||
("user", "0014_user_preferred_name"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveConstraint( | ||
model_name="user", | ||
name="preferred_name", | ||
), | ||
migrations.AddConstraint( | ||
model_name="user", | ||
constraint=models.CheckConstraint( | ||
check=models.Q( | ||
("preferred_name__regex", "^([.:]\\s|[^.:])+[.:]?$") | ||
), | ||
name="preferred_name", | ||
violation_error_message="Preferred name can only contain '.' or ':' if followed by whitespace or if located at the end.", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters