Tuesday, February 28, 2017

attribute required and error XML

Hi all,
I have  an problem. When I use the django library  form, It create an attribute "required" for an input. But when I look on my explorer (firefox or chrome or IE) i have a XML error.
"XML parsing error: malformed".

this is my code :
"
class LoginForm(forms.Form):
email = forms.EmailField(label='Courriel :')
password = forms.CharField(label='Mot de passe :',
widget = forms.PasswordInput)
def clean(self):
cleaned_data = super (LoginForm,self).clean()
email = cleaned_data.get("email")
password = cleaned_data.get("password")
if email and password:
if password != 'bob' or email != 'bob@bob.fr' :
raise forms.ValidationError("Adresse de courriel ou mot de passe erroné.")
return cleaned_data
"

this is my déclaration for XML and doctype :
"
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"> "

I can put "required=False" and it's OK, but I want that my input is required (required=True it's not OK)
XML don't accept that required attribute is alone, whithout "= someting".

If someone has had this problem?

Django 1.10
Firefox last update

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8cb6a10b-fc89-4f9a-814e-a905ea9eef6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment