1
0
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:
Claude Paroz
2012-08-03 15:18:13 +02:00
parent 2407c45c18
commit 9908201d7f
6 changed files with 15 additions and 15 deletions

View File

@@ -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."""

View File

@@ -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 = {