Re: Disable autocomplete in admin field

2015-11-13 Thread Erik Cederstrand
> Den 12. nov. 2015 kl. 14.41 skrev Erik Cederstrand > : > > Hi Ezequeil, > > Thanks for the explanation! This worked, but defining a new widget from > scratch meant that I lost the other helpful attributes (length, class etc.) > that the admin adds for me.

Re: Disable autocomplete in admin field

2015-11-12 Thread Ezequiel Bertti
Great! If you prefer to write some code and not implement new class. What you thing to override the *get_form *method on model admin? https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_form def get_form(self, request, obj=None, **kwargs): form =

Re: Disable autocomplete in admin field

2015-11-12 Thread Erik Cederstrand
Hi Ezequeil, Thanks for the explanation! This worked, but defining a new widget from scratch meant that I lost the other helpful attributes (length, class etc.) that the admin adds for me. Instead, in the DRY spirit, I opted to just add this one extra attribute. Here's the relevant code:

Re: Disable autocomplete in admin field

2015-11-12 Thread Ezequiel Bertti
In html: Um django you need to create a form for your model and set a field to username. In this field, set a widget like this: username = forms.CharField(widget=forms.TextInput(attrs={'autocomplete': 'off'})) Now you set a form on your model admin, like this example

Disable autocomplete in admin field

2015-11-12 Thread Erik Cederstrand
Hello, I have a model with a CharField named "username". When I edit a model instance in the admin, my browser likes to autocomplete the contents of the "username" field with my username for the Django site, regardless of what was entered previously. Is there anything I can do to disable this