mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Added "allow_unicode" to generated kwargs for ModelSerializer SlugField (#6315)
This commit is contained in:
parent
7ad5bdb669
commit
963ce306f3
|
@ -88,6 +88,9 @@ def get_field_kwargs(field_name, model_field):
|
|||
if decimal_places is not None:
|
||||
kwargs['decimal_places'] = decimal_places
|
||||
|
||||
if isinstance(model_field, models.SlugField):
|
||||
kwargs['allow_unicode'] = model_field.allow_unicode
|
||||
|
||||
if isinstance(model_field, models.TextField) or (postgres_fields and isinstance(model_field, postgres_fields.JSONField)):
|
||||
kwargs['style'] = {'base_template': 'textarea.html'}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ class TestRegularFieldMappings(TestCase):
|
|||
null_boolean_field = NullBooleanField(required=False)
|
||||
positive_integer_field = IntegerField()
|
||||
positive_small_integer_field = IntegerField()
|
||||
slug_field = SlugField(max_length=100)
|
||||
slug_field = SlugField(allow_unicode=False, max_length=100)
|
||||
small_integer_field = IntegerField()
|
||||
text_field = CharField(max_length=100, style={'base_template': 'textarea.html'})
|
||||
file_field = FileField(max_length=100)
|
||||
|
|
Loading…
Reference in New Issue
Block a user