Make text optional
This commit is contained in:
parent
823ee5a6c7
commit
34868bd0a5
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 4.0.3 on 2022-04-12 21:00
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('main', '0005_thought_media_alt'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='thought',
|
||||||
|
name='text',
|
||||||
|
field=models.CharField(blank=True, max_length=140),
|
||||||
|
),
|
||||||
|
]
|
|
@ -11,7 +11,7 @@ from django.core.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
class Thought(models.Model):
|
class Thought(models.Model):
|
||||||
text = models.CharField(max_length=140)
|
text = models.CharField(max_length=140, blank=True)
|
||||||
extended_text = models.TextField(blank=True)
|
extended_text = models.TextField(blank=True)
|
||||||
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
|
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
|
||||||
posted = models.DateTimeField(auto_now_add=True)
|
posted = models.DateTimeField(auto_now_add=True)
|
||||||
|
@ -96,9 +96,6 @@ class ThoughtForm(forms.ModelForm):
|
||||||
|
|
||||||
error_messages = {
|
error_messages = {
|
||||||
"text": {
|
"text": {
|
||||||
# It's debatable whether this is actually a "nice" error message
|
|
||||||
# but I've grown fond of it
|
|
||||||
"required": "Need some text.",
|
|
||||||
"max_length": "Text must be at most 140 characters."
|
"max_length": "Text must be at most 140 characters."
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,6 +148,10 @@ h1 {
|
||||||
display: block; /*Needs to be inline-block or block, so that margin on it works*/
|
display: block; /*Needs to be inline-block or block, so that margin on it works*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.thought .main {
|
||||||
|
min-height: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
.thought-end {
|
.thought-end {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
Loading…
Reference in New Issue