Deleting the Form Field Label in Django

greenteabiscuit

Reishi Mitani

Posted on August 29, 2020

Deleting the Form Field Label in Django

The label Comment Text kept appearing on the form.

Alt Text

By adding the labels dictionary in the form file, I was able to get rid of the label.



class CommentForm(forms.ModelForm):

    class Meta:
        model = Comment
        fields = ['comment_text', ]
        labels = {
            "comment_text": ""
        }



Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
greenteabiscuit
Reishi Mitani

Posted on August 29, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

What was your win this week?
weeklyretro What was your win this week?

November 29, 2024

Where GitOps Meets ClickOps
devops Where GitOps Meets ClickOps

November 29, 2024

How to Use KitOps with MLflow
beginners How to Use KitOps with MLflow

November 29, 2024

Modern C++ for LeetCode 🧑‍💻🚀
leetcode Modern C++ for LeetCode 🧑‍💻🚀

November 29, 2024