diff --git a/readthedocs/core/forms.py b/readthedocs/core/forms.py index 1e0aeeee433..645b83355f3 100644 --- a/readthedocs/core/forms.py +++ b/readthedocs/core/forms.py @@ -1,8 +1,6 @@ """Forms for core app.""" import structlog -from crispy_forms.helper import FormHelper -from crispy_forms.layout import Fieldset, Layout, Submit from django import forms from django.contrib.auth.models import User from django.core.exceptions import NON_FIELD_ERRORS @@ -23,15 +21,7 @@ class UserProfileForm(forms.ModelForm): class Meta: model = UserProfile # Don't allow users edit someone else's user page - profile_fields = ["first_name", "last_name", "homepage"] - optout_email_fields = [ - "optout_email_config_file_deprecation", - "optout_email_build_image_deprecation", - ] - fields = ( - *profile_fields, - *optout_email_fields, - ) + fields = ["first_name", "last_name", "homepage"] def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -41,20 +31,6 @@ def __init__(self, *args, **kwargs): except AttributeError: pass - self.helper = FormHelper() - field_sets = [ - Fieldset( - _("User settings"), - *self.Meta.profile_fields, - ), - Fieldset( - _("Email settings"), - *self.Meta.optout_email_fields, - ), - ] - self.helper.layout = Layout(*field_sets) - self.helper.add_input(Submit("save", _("Save"))) - def save(self, commit=True): first_name = self.cleaned_data.pop("first_name", None) last_name = self.cleaned_data.pop("last_name", None) diff --git a/readthedocs/core/migrations/0015_remove_email_options.py b/readthedocs/core/migrations/0015_remove_email_options.py new file mode 100644 index 00000000000..f3160a3f70c --- /dev/null +++ b/readthedocs/core/migrations/0015_remove_email_options.py @@ -0,0 +1,31 @@ +# Generated by Django 4.2.10 on 2024-02-27 18:55 + +from django.db import migrations +from django_safemigrate import Safe + + +class Migration(migrations.Migration): + safe = Safe.after_deploy + + dependencies = [ + ("core", "0014_optout_email_build_image_deprecation"), + ] + + operations = [ + migrations.RemoveField( + model_name="historicaluserprofile", + name="optout_email_build_image_deprecation", + ), + migrations.RemoveField( + model_name="historicaluserprofile", + name="optout_email_config_file_deprecation", + ), + migrations.RemoveField( + model_name="userprofile", + name="optout_email_build_image_deprecation", + ), + migrations.RemoveField( + model_name="userprofile", + name="optout_email_config_file_deprecation", + ), + ] diff --git a/readthedocs/core/models.py b/readthedocs/core/models.py index 3ad3777ea01..5cab8ae43f1 100644 --- a/readthedocs/core/models.py +++ b/readthedocs/core/models.py @@ -43,22 +43,6 @@ class UserProfile(TimeStampedModel): whitelisted = models.BooleanField(_("Whitelisted"), default=False) banned = models.BooleanField(_("Banned"), default=False) - # Opt-out on emails - # NOTE: this is a temporary field that we can remove after September 25, 2023 - # See https://blog.readthedocs.com/migrate-configuration-v2/ - optout_email_config_file_deprecation = models.BooleanField( - _("Opt-out from email about 'Config file deprecation'"), - default=False, - null=True, - ) - # NOTE: this is a temporary field that we can remove after October 16, 2023 - # See https://blog.readthedocs.com/use-build-os-config/ - optout_email_build_image_deprecation = models.BooleanField( - _("Opt-out from email about '\"build.image\" config key deprecation'"), - default=False, - null=True, - ) - # Model history history = ExtraHistoricalRecords() diff --git a/readthedocs/templates/profiles/private/edit_profile.html b/readthedocs/templates/profiles/private/edit_profile.html index a86a4140d5e..da23ad74d89 100644 --- a/readthedocs/templates/profiles/private/edit_profile.html +++ b/readthedocs/templates/profiles/private/edit_profile.html @@ -1,5 +1,4 @@ {% extends "profiles/base_profile_edit.html" %} -{% load crispy_forms_tags %} {% load i18n %} @@ -10,5 +9,8 @@ {% block edit_content_header %} {% trans "Edit your profile" %} {% endblock %} {% block edit_content %} - {% crispy form %} +
{% csrf_token %} + {{ form.as_p }} + +
{% endblock %}