mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Replaced some byte strings by str() calls
This is a useful trick when Python 2 awaits byte strings and Python 3 Unicode (regular) strings.
This commit is contained in:
@@ -365,7 +365,7 @@ def formset_factory(form, formset=BaseFormSet, extra=1, can_order=False,
|
||||
attrs = {'form': form, 'extra': extra,
|
||||
'can_order': can_order, 'can_delete': can_delete,
|
||||
'max_num': max_num}
|
||||
return type(form.__name__ + b'FormSet', (formset,), attrs)
|
||||
return type(form.__name__ + str('FormSet'), (formset,), attrs)
|
||||
|
||||
def all_valid(formsets):
|
||||
"""Returns true if every formset in formsets is valid."""
|
||||
|
||||
@@ -389,10 +389,10 @@ def modelform_factory(model, form=ModelForm, fields=None, exclude=None,
|
||||
parent = (object,)
|
||||
if hasattr(form, 'Meta'):
|
||||
parent = (form.Meta, object)
|
||||
Meta = type(b'Meta', parent, attrs)
|
||||
Meta = type(str('Meta'), parent, attrs)
|
||||
|
||||
# Give this new form class a reasonable name.
|
||||
class_name = model.__name__ + b'Form'
|
||||
class_name = model.__name__ + str('Form')
|
||||
|
||||
# Class attributes for the new form class.
|
||||
form_class_attrs = {
|
||||
|
||||
Reference in New Issue
Block a user