|
7 | 7 | from django.db import models
|
8 | 8 | from django.db.models.constants import LOOKUP_SEP
|
9 | 9 | from django.db.models.fields.related import ManyToManyRel, ManyToOneRel, OneToOneRel
|
10 |
| -from django.utils.datastructures import MultiValueDict |
| 10 | +from django.http import QueryDict |
11 | 11 |
|
12 | 12 | from .conf import settings
|
13 | 13 | from .constants import ALL_FIELDS
|
@@ -61,7 +61,11 @@ def __init__(self, options=None):
|
61 | 61 |
|
62 | 62 | self.form = getattr(options, "form", forms.Form)
|
63 | 63 |
|
64 |
| - behavior = getattr(options, "unknown_field_behavior", UnknownFieldBehavior.RAISE) |
| 64 | + behavior = getattr( |
| 65 | + options, |
| 66 | + "unknown_field_behavior", |
| 67 | + UnknownFieldBehavior.RAISE, |
| 68 | + ) |
65 | 69 |
|
66 | 70 | if not isinstance(behavior, UnknownFieldBehavior):
|
67 | 71 | raise ValueError(f"Invalid unknown_field_behavior: {behavior}")
|
@@ -192,7 +196,7 @@ def __init__(self, data=None, queryset=None, *, request=None, prefix=None):
|
192 | 196 | model = queryset.model
|
193 | 197 |
|
194 | 198 | self.is_bound = data is not None
|
195 |
| - self.data = data or MultiValueDict() |
| 199 | + self.data = data or QueryDict() |
196 | 200 | self.queryset = queryset
|
197 | 201 | self.request = request
|
198 | 202 | self.form_prefix = prefix
|
@@ -380,7 +384,9 @@ def handle_unrecognized_field(cls, field_name, message):
|
380 | 384 | if behavior == UnknownFieldBehavior.RAISE:
|
381 | 385 | raise AssertionError(message)
|
382 | 386 | elif behavior == UnknownFieldBehavior.WARN:
|
383 |
| - warnings.warn(f"Unrecognized field type for '{field_name}'. Field will be ignored.") |
| 387 | + warnings.warn( |
| 388 | + f"Unrecognized field type for '{field_name}'. Field will be ignored." |
| 389 | + ) |
384 | 390 | elif behavior == UnknownFieldBehavior.IGNORE:
|
385 | 391 | pass
|
386 | 392 | else:
|
|
0 commit comments