10👍
✅
The Django documentation on customizing labels says it could be turned off with auto_id
argument to Form constructor:
f = ContactForm(auto_id=False)
36👍
This should work with the latest version (trunk) of django:
comment = forms.CharField(label="", help_text="", widget=forms.Textarea())
Hope that helps!
- Django template tag: How to send next_page in {url auth_logout}?
- How to write unit tests for django-rest-framework api's?
- Customizing django admin ChangeForm template / adding custom content
- No web processes running Django in heroku
4👍
Try this in your form:
def __init__(self, *args, **kwargs):
self.fields['comment'].label = ''
But for newer versions of django i prefer Iemonad’s answer
2👍
Not sure about old Django but u can now empty the form field labels in Meta for the new Django
class CustomForm(forms.Form):
class Meta:
... #other properties such as model, fields, widgets and help text
labels = {
'comment' : '',
}
- Django Rest Framework: Serialize data from nested json fields to plain object
- Django ALLOWED_HOSTS with ELB HealthCheck
- All the values of the many to many field : Django
- How do I get the django HttpRequest from a django rest framework Request?
0👍
A quick-and-dirty solution would be to iterate through the form manualy (with {% for field in form %}) and handle the “problematic” field specially. You could also override the as_p/as_table methods if needed.
👤oggy
- Django migrate and makemigrate automatic yes on prompt
- What does "Directory indexes are not allowed here." mean in a Django error?
- How do I serve media files in a local Django environment?
- Saving a Pandas DataFrame to a Django Model
0👍
here is another solution that had worked for me
with this
{% for field in form %} {{field.errors}} {% endfor %}
- Django's {{ csrf_token }} is outputting the token value only, without the hidden input markup
- Trouble with Django sending email though smtp.gmail.com
- Should I use Celery or Carrot for a Django project?
Source:stackexchange.com