Don't strip whitespace from the start or end of thoughts
* Refactor to specify fields directly; shouldn't effect any other behavior
This commit is contained in:
parent
727bbf6fc5
commit
1d89272d99
|
@ -64,6 +64,22 @@ ALLOWED_MEDIA_TYPES = {
|
||||||
|
|
||||||
|
|
||||||
class ThoughtForm(forms.ModelForm):
|
class ThoughtForm(forms.ModelForm):
|
||||||
|
text = CharField(
|
||||||
|
strip=False,
|
||||||
|
widget=forms.Textarea(attrs={"class": "thought", "rows": 1, "placeholder": "What are you thinking?"}),
|
||||||
|
required=False,
|
||||||
|
max_length=140
|
||||||
|
)
|
||||||
|
extended_text = CharField(
|
||||||
|
strip=False,
|
||||||
|
widget=forms.Textarea(attrs={"class": "thought", "rows": 1, "placeholder": "Anything else?"}),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
media_alt = CharField(
|
||||||
|
widget=forms.Textarea(attrs={"placeholder": "Media alternate text, please", "rows": 1}),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
|
||||||
def clean_media(self):
|
def clean_media(self):
|
||||||
f = self.cleaned_data["media"]
|
f = self.cleaned_data["media"]
|
||||||
if not f:
|
if not f:
|
||||||
|
@ -85,15 +101,7 @@ class ThoughtForm(forms.ModelForm):
|
||||||
model = Thought
|
model = Thought
|
||||||
exclude = ["posted"]
|
exclude = ["posted"]
|
||||||
widgets = {
|
widgets = {
|
||||||
"text": forms.Textarea(attrs={"class": "thought", "rows": 1, "placeholder": "What are you thinking?"}),
|
|
||||||
"extended_text": forms.Textarea(attrs={"class": "thought", "rows": 1, "placeholder": "Anything else?"}),
|
|
||||||
"timezone_offset": forms.NumberInput,
|
"timezone_offset": forms.NumberInput,
|
||||||
"media_alt": forms.Textarea(attrs={"placeholder": "Media alternate text, please", "rows": 1})
|
|
||||||
}
|
|
||||||
field_classes = {
|
|
||||||
"text": CharField,
|
|
||||||
"extended_text": CharField,
|
|
||||||
"media_alt": CharField,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
error_messages = {
|
error_messages = {
|
||||||
|
|
Loading…
Reference in New Issue