1👍
Rather than defining it in the Meta
class, try defining it your form definition like so:
email = forms.EmailField(label='email',
widget=forms.TextInput(attrs={'placeholder': 'example@domain.com'}))
Or you could do this in jQuery like so:
<script type="text/javascript" >
$(document).ready(function(){
$("#id_username").attr('placeholder', '{{form.username.label}}');
$("#id_email").attr('placeholder', '{{form.email.label}}');
});
</script>
And then define your label='example@domain.com'
.
Edit
You could try reinitializing an empty form after your user logs in like so:
if request.method == "POST":
rf = RegistrationForm(request.POST)
if rf.is_valid():
# This reinitializes an empty form before rendering a response
rf = LoginForm()
return render_to_response(...)
0👍
Just to use placeholder for that
class Meta:
model = User
widgets = {
'password': forms.PasswordInput(),
'email': EmailInput(attrs={'placeholder': 'something@something.com'}),
}
- [Answer]-How to parse div tag from alexa.com and show results in table in django
- [Answer]-Request.POST empty for Content-Type: multipart/form-data; boundary=xYzZY
- [Answer]-Can I link Django permissions to a model class instead of User instances?
Source:stackexchange.com