6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2025-01-09 16:36:29 +00:00

fix: site name limited to 50 characters (#1145)

Before this, building organizations with longer URLs failed since the
name field inside Site model has a max_length=50

Close #1144
This commit is contained in:
Emad Rad 2024-10-24 09:41:31 +03:30 committed by GitHub
parent 97e9fa4751
commit 2440970c58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -0,0 +1 @@
- [Bugfix] Fixed an issue where the site name was not limited to 50 characters when creating a new site configuration. (by @CodeWithEmad)

View File

@ -60,7 +60,9 @@ def get_site_configuration(domain):
domain = domain or settings.LMS_BASE
site, site_created = Site.objects.get_or_create(domain=domain)
if site_created:
site.name = domain
# Limit the site name to 50 characters
# https://github.com/django/django/blob/4.2.16/django/contrib/sites/models.py#L86
site.name = domain[:50]
site.save()
configuration, configuration_created = SiteConfiguration.objects.get_or_create(site=site)
if configuration_created: