Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(admin): Make folder type editable in admin and support dot in fo… #14

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sage_mailbox/admin/mailbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MailboxAdmin(admin.ModelAdmin):
(None, {"fields": ("name", "slug", "folder_type")}),
(_("Change Log"), {"fields": ("created_at", "modified_at")}),
)
readonly_fields = ("folder_type", "created_at", "modified_at")
readonly_fields = ("created_at", "modified_at")
actions = [delete_selected]

def get_readonly_fields(self, request, obj=None):
Expand Down
4 changes: 2 additions & 2 deletions sage_mailbox/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class FolderNameValidator:
"""

length_error_message = "Folder name must be between 1 and 255 characters long."
character_error_message = "Folder name contains invalid characters. Allowed characters are letters, numbers, underscore, and hyphen. Spaces are not allowed."
character_error_message = "Folder name contains invalid characters. Allowed characters are letters, numbers, underscore, hyphen, and dot. Spaces are not allowed."
code_length = "folder_name_length"
code_character = "folder_name_invalid_character"
regex = re.compile(r"^[\w-]+$")
regex = re.compile(r"^[\w.-]+$")

def __call__(self, value):
if not (1 <= len(value) <= 255):
Expand Down
Loading