diff --git a/django/forms/models.py b/django/forms/models.py
index 938535b..08f4600 100644
a
|
b
|
class ModelFormMetaclass(DeclarativeFieldsMetaclass):
|
257 | 257 | raise FieldError(message) |
258 | 258 | # Override default model fields with any custom declared ones |
259 | 259 | # (plus, include all the other declared fields). |
260 | | fields.update(new_class.declared_fields) |
| 260 | declare_field_list = [] |
| 261 | for declare_field in new_class.declared_fields.items(): |
| 262 | if opts.fields is not None and declare_field[0] not in opts.fields: |
| 263 | continue |
| 264 | if opts.exclude and declare_field[0] in opts.exclude: |
| 265 | continue |
| 266 | declare_field_list.append(declare_field) |
| 267 | if declare_field_list: |
| 268 | fields.update(declare_field_list) |
261 | 269 | else: |
262 | 270 | fields = new_class.declared_fields |
263 | 271 | |