From 8f42885482e9d79555b353bb393cbd4c2a35bce9 Mon Sep 17 00:00:00 2001 From: yucyle <121172468+yucyle@users.noreply.github.com> Date: Tue, 8 Aug 2023 17:30:47 +0700 Subject: [PATCH] Remove group adding in edit profile --- judge/forms.py | 18 ------------------ templates/user/edit-profile.html | 8 +------- 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/judge/forms.py b/judge/forms.py index 44acd0f..504338b 100644 --- a/judge/forms.py +++ b/judge/forms.py @@ -74,7 +74,6 @@ class ProfileForm(ModelForm): model = Profile fields = [ "about", - "organizations", "timezone", "language", "ace_theme", @@ -98,26 +97,9 @@ class ProfileForm(ModelForm): attrs={"style": "max-width:700px;min-width:700px;width:700px"}, ) - def clean(self): - organizations = self.cleaned_data.get("organizations") or [] - max_orgs = settings.DMOJ_USER_MAX_ORGANIZATION_COUNT - - if sum(org.is_open for org in organizations) > max_orgs: - raise ValidationError( - _("You may not be part of more than {count} public groups.").format( - count=max_orgs - ) - ) - - return self.cleaned_data - def __init__(self, *args, **kwargs): user = kwargs.pop("user", None) super(ProfileForm, self).__init__(*args, **kwargs) - if not user.has_perm("judge.edit_all_organization"): - self.fields["organizations"].queryset = Organization.objects.filter( - Q(is_open=True) | Q(id__in=user.profile.organizations.all()), - ) def file_size_validator(file): diff --git a/templates/user/edit-profile.html b/templates/user/edit-profile.html index 05f3b2c..8d2e9ee 100644 --- a/templates/user/edit-profile.html +++ b/templates/user/edit-profile.html @@ -44,7 +44,7 @@ #center-float { position: relative; margin: 0 auto auto -28.5em; - left: 50%; + left: 60%; width: 700px; } @@ -142,12 +142,6 @@ -