I created a django form and tried to add placeholder and remove the form label. i came across a solution to add the palceholder but it seems to have no effect.
This is forms.py
class AppForm(forms.ModelForm):
class Meta:
model = App
fields = ('__all__')
def __init__(self, *args, **kwargs):
super(AppForm, self).__init__(*args, **kwargs)
self.fields['appname'].widget.attrs['placeholder'] = 'App Name'
self.fields['link'].widget.attrs['placeholder'] = 'App Link'
This is my html file
{% extends 'main/base.html' %}
{% load static %}
{% load crispy_forms_tags %}
{% block content %}
<div class="content-above"> </div>
<div class="content">
<div>
<form action="" method="post" autocomplete="off" enctype="multipart/form-data">
<div>
{% csrf_token %}
{{ form.appname|as_crispy_field }}
{{ form.link|as_crispy_field }}
</div>
<div class="row">
<div class="col-md-8">
<button type="submit">Submit</button>
</div>
<div class="col-md-4">
<a href="{% url 'app_list' %}">Back to list</a>
</div>
</form>
</div>
</div>
{% endblock content %}
Please help and if possible also tell me how to remove the default label!

so all I had to do was get the indentation right
new
old