I want to create a custom name for on of the labels in my modelform this is my forms.py
class PostForm(forms.ModelForm):
body = forms.CharField(widget=PagedownWidget)
publish = forms.DateField(
widget=forms.SelectDateWidget,
initial=datetime.date.today,
)
class Meta:
model = Post
fields = [
"title",
"body",
"author",
"image",
"image_url",
"video_path",
"video",
"publish",
"tags",
"status"
]
I want to change the instead of video I want it to say embed. I checked the documentation but didn't find anything that would help me do that. is it possible without me having to rearrange my model? if so how? thanks
From the documentation:
You can specify the labels, help_texts and error_messages attributes of the inner Meta class if you want to further customize a field.
There are examples just below that section of the docs. So, you can do:
class Meta:
model = Post
labels = {
"video": "Embed"
}