django: Changing auto_id of ModelForm based form class

Posted by Meilo on Stack Overflow See other posts from Stack Overflow or by Meilo
Published on 2013-11-07T09:28:23Z Indexed on 2013/11/07 9:53 UTC
Read the original article Hit count: 264

Filed under:
|
|

Every time I create an instance of the TestForm specified below, I have to overwrite the standard id format with auto_id=True. How can this be done once only in the form class instead? Any hints are very welcome.

views.py

from django.forms import ModelForm
from models import Test

class TestForm(ModelForm):
    class Meta:
        model = Test

def test(request):
    form = TestForm(auto_id=True)

© Stack Overflow or respective owner

Related posts about python

Related posts about django