diff options
| author | Paolo Melchiorre <paolo@melchiorre.org> | 2023-09-15 15:30:06 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-09-16 20:13:02 +0200 |
| commit | 2f1ab16be54255213d5c3e4d925a3a24997dc917 (patch) | |
| tree | 64de479179d57aa0e802243140e323dae38ce8cf /django/db/models/query_utils.py | |
| parent | aebedb7bd1bd9774823d15cc1041dcdce6fb172a (diff) | |
Fixed #34842 -- Fixed ModelAdmin.readonly_fields crash with GeneratedFields.
Diffstat (limited to 'django/db/models/query_utils.py')
| -rw-r--r-- | django/db/models/query_utils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py index 9754864eef..4f3358eb8d 100644 --- a/django/db/models/query_utils.py +++ b/django/db/models/query_utils.py @@ -199,7 +199,7 @@ class DeferredAttribute: val = self._check_parent_chain(instance) if val is None: if instance.pk is None and self.field.generated: - raise FieldError( + raise AttributeError( "Cannot read a generated field from an unsaved model." ) instance.refresh_from_db(fields=[field_name]) |
