1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Fixed #24788 -- Allowed Forms to specify a prefix at the class level.

This commit is contained in:
Paweł Marczewski
2015-05-24 20:43:20 +02:00
committed by Tim Graham
parent 4ccfc4439a
commit 4df7e8483b
4 changed files with 28 additions and 1 deletions

View File

@@ -75,6 +75,7 @@ class BaseForm(object):
# information. Any improvements to the form API should be made to *this*
# class, not to the Form class.
field_order = None
prefix = None
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
initial=None, error_class=ErrorList, label_suffix=None,
@@ -83,7 +84,8 @@ class BaseForm(object):
self.data = data or {}
self.files = files or {}
self.auto_id = auto_id
self.prefix = prefix
if prefix is not None:
self.prefix = prefix
self.initial = initial or {}
self.error_class = error_class
# Translators: This is the default suffix added to form field labels