mirror of
https://github.com/etnguyen03/tjdests.git
synced 2025-04-18 17:20:15 -04:00
fix(profile): remove carriage returns from biographies on save
This commit is contained in:
parent
8694e25247
commit
e9fc4261b7
|
@ -24,6 +24,17 @@ class ProfilePublishForm(forms.ModelForm):
|
|||
)
|
||||
|
||||
def clean(self) -> Dict[str, Any]:
|
||||
data = self.data.copy()
|
||||
|
||||
# Remove carriage returns from biography
|
||||
if data.get("biography"):
|
||||
data["biography"] = data["biography"].replace("\r", "")
|
||||
self.instance.biography = data["biography"]
|
||||
if len(data["biography"]) <= self.fields["biography"].max_length:
|
||||
if self.errors.get("biography"):
|
||||
del self.errors["biography"]
|
||||
|
||||
self.data = data
|
||||
cleaned_data = super().clean()
|
||||
|
||||
# Check the GPA: 0.0 <= GPA <= 5.0
|
||||
|
|
Loading…
Reference in New Issue
Block a user