I'm capturing sensitive information on the main page of my Django project. Is there a way to prevent the previous login info from showing when a user clicks or starts typing in the box?
as_p() [Django-doc] is a method on a Form . It produces a SafeText object [Django-doc] that contains HTML code to be included in the template. The fact that it is SafeText is important, since the Django render engine will otherwise "escape" it: without using SafeText , it would replace < with < ; > with > , etc.
GET and POSTDjango's login form is returned using the POST method, in which the browser bundles up the form data, encodes it for transmission, sends it to the server, and then receives back its response. GET , by contrast, bundles the submitted data into a string, and uses this to compose a URL.
You can disable autocomplete on such fields by setting the HTML5 autocomplete
attribute to off
. To achieve this in Django's forms you need to pass additional information to the widget for each input, e.g.:
class MyForm(forms.Form):
secret = forms.CharField(widget=forms.TextInput(attrs={'autocomplete': 'off'}))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With