diff --git a/marshmallow/fields.py b/marshmallow/fields.py
index ecfd28d4..737fbfb0 100755
--- a/marshmallow/fields.py
+++ b/marshmallow/fields.py
@@ -1134,6 +1134,15 @@ class Dict(Field):
                                  'marshmallow.base.FieldABC')
             self.key_container = keys
 
+    def _add_to_schema(self, field_name, schema):
+        super(Dict, self)._add_to_schema(field_name, schema)
+        if self.value_container:
+            self.value_container.parent = self
+            self.value_container.name = field_name
+        if self.key_container:
+            self.key_container.parent = self
+            self.key_container.name = field_name
+
     def _serialize(self, value, attr, obj):
         if value is None:
             return None

Question: How can I pass the context in a nested field of a structured dict?
I noticed that if you use a nested field for values in a structured Dict, the context is not automatically given to the nested schema. Is there a way to pass it the context?

Example:
```python
class Inner(Schema):
    foo = fields.String()

    @validates('foo')
    def validate_foo(self, value):
        if 'foo_context' not in self.context:
            raise ValidationError('no context!')


class Outer(Schema):
    bar = fields.Dict(values=fields.Nested(Inner))

# gives no error:
Inner(context={'foo_context': 'foo'}).load({'foo': 'some foo'})
# gives 'no context!' error:
Outer(context={'foo_context': 'foo'}).load({'bar': { 'key': {'foo': 'some foo'}}})
```
diff --git a/tests/test_schema.py b/tests/test_schema.py
index 17c04300..9fee0d63 100755
--- a/tests/test_schema.py
+++ b/tests/test_schema.py
@@ -2134,6 +2134,27 @@ class TestContext:
         outer.context['foo_context'] = 'foo'
         assert outer.load({'bars': [{'foo': 42}]})
 
+    # Regression test for https://github.com/marshmallow-code/marshmallow/issues/820
+    def test_nested_dict_fields_inherit_context(self):
+        class InnerSchema(Schema):
+            foo = fields.Field()
+
+            @validates('foo')
+            def validate_foo(self, value):
+                if 'foo_context' not in self.context:
+                    raise ValidationError('Missing context')
+
+        class OuterSchema(Schema):
+            bars = fields.Dict(values=fields.Nested(InnerSchema()))
+
+        inner = InnerSchema()
+        inner.context['foo_context'] = 'foo'
+        assert inner.load({'foo': 42})
+
+        outer = OuterSchema()
+        outer.context['foo_context'] = 'foo'
+        assert outer.load({'bars': {'test': {'foo': 42}}})
+
 
 def test_serializer_can_specify_nested_object_as_attribute(blog):
     class BlogUsernameSchema(Schema):

pip install -e .[reco]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
3.9
dev-requirements.txt requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==25.3.0
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.2
execnet==2.1.1
filelock==3.18.0
flake8==3.5.0
iniconfig==2.1.0
invoke==1.0.0
-e git+https://github.com/marshmallow-code/marshmallow.git@bfc6bedf291bb54f8623acc9380139c06bc8acb2#egg=marshmallow
mccabe==0.6.1
more-itertools==10.6.0
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
py==1.11.0
pycodestyle==2.3.1
pyflakes==1.6.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
python-dateutil==2.7.3
pytz==2018.4
simplejson==3.15.0
six==1.17.0
toml==0.10.2
tomli==2.2.1
tox==3.12.1
typing_extensions==4.13.0
virtualenv==20.29.3

name: marshmallow
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==25.3.0
      - coverage==7.8.0
      - distlib==0.3.9
      - exceptiongroup==1.2.2
      - execnet==2.1.1
      - filelock==3.18.0
      - flake8==3.5.0
      - iniconfig==2.1.0
      - invoke==1.0.0
      - mccabe==0.6.1
      - more-itertools==10.6.0
      - packaging==24.2
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - py==1.11.0
      - pycodestyle==2.3.1
      - pyflakes==1.6.0
      - pytest==8.3.5
      - pytest-asyncio==0.26.0
      - pytest-cov==6.0.0
      - pytest-mock==3.14.0
      - pytest-xdist==3.6.1
      - python-dateutil==2.7.3
      - pytz==2018.4
      - simplejson==3.15.0
      - six==1.17.0
      - toml==0.10.2
      - tomli==2.2.1
      - tox==3.12.1
      - typing-extensions==4.13.0
      - virtualenv==20.29.3
prefix: /opt/conda/envs/marshmallow

tests/test_schema.py::TestContext::test_nested_dict_fields_inherit_context
tests/test_schema.py::test_serializing_basic_object[UserSchema] tests/test_schema.py::test_serializing_basic_object[UserMetaSchema] tests/test_schema.py::test_serializer_dump tests/test_schema.py::test_dump_raises_with_dict_of_errors tests/test_schema.py::test_dump_mode_raises_error[UserSchema] tests/test_schema.py::test_dump_mode_raises_error[UserMetaSchema] tests/test_schema.py::test_dump_resets_errors tests/test_schema.py::test_load_resets_errors tests/test_schema.py::test_load_validation_error_stores_input_data_and_valid_data tests/test_schema.py::test_dump_validation_error_stores_partially_valid_data tests/test_schema.py::test_dump_resets_error_fields tests/test_schema.py::test_load_resets_error_fields tests/test_schema.py::test_load_resets_error_kwargs tests/test_schema.py::test_errored_fields_do_not_appear_in_output tests/test_schema.py::test_load_many_stores_error_indices tests/test_schema.py::test_dump_many tests/test_schema.py::test_multiple_errors_can_be_stored_for_a_given_index tests/test_schema.py::test_dump_many_stores_error_indices tests/test_schema.py::test_dump_many_doesnt_stores_error_indices_when_index_errors_is_false tests/test_schema.py::test_dump_returns_a_dict tests/test_schema.py::test_dumps_returns_a_string tests/test_schema.py::test_dumping_single_object_with_collection_schema tests/test_schema.py::test_loading_single_object_with_collection_schema tests/test_schema.py::test_dumps_many tests/test_schema.py::test_load_returns_an_object tests/test_schema.py::test_load_many tests/test_schema.py::test_loads_returns_a_user tests/test_schema.py::test_loads_many tests/test_schema.py::test_loads_deserializes_from_json tests/test_schema.py::test_serializing_none tests/test_schema.py::test_default_many_symmetry tests/test_schema.py::test_on_bind_field_hook tests/test_schema.py::test_nested_on_bind_field_hook tests/test_schema.py::TestValidate::test_validate_raises_with_errors_dict tests/test_schema.py::TestValidate::test_validate_many tests/test_schema.py::TestValidate::test_validate_many_doesnt_store_index_if_index_errors_option_is_false tests/test_schema.py::TestValidate::test_validate tests/test_schema.py::TestValidate::test_validate_required tests/test_schema.py::test_fields_are_not_copies[UserSchema] tests/test_schema.py::test_fields_are_not_copies[UserMetaSchema] tests/test_schema.py::test_dumps_returns_json tests/test_schema.py::test_naive_datetime_field tests/test_schema.py::test_datetime_formatted_field tests/test_schema.py::test_datetime_iso_field tests/test_schema.py::test_tz_datetime_field tests/test_schema.py::test_local_datetime_field tests/test_schema.py::test_class_variable tests/test_schema.py::test_serialize_many[UserSchema] tests/test_schema.py::test_serialize_many[UserMetaSchema] tests/test_schema.py::test_inheriting_schema tests/test_schema.py::test_custom_field tests/test_schema.py::test_url_field tests/test_schema.py::test_relative_url_field tests/test_schema.py::test_stores_invalid_url_error[UserSchema] tests/test_schema.py::test_stores_invalid_url_error[UserMetaSchema] tests/test_schema.py::test_email_field[UserSchema] tests/test_schema.py::test_email_field[UserMetaSchema] tests/test_schema.py::test_stored_invalid_email tests/test_schema.py::test_integer_field tests/test_schema.py::test_as_string tests/test_schema.py::test_method_field[UserSchema] tests/test_schema.py::test_method_field[UserMetaSchema] tests/test_schema.py::test_function_field tests/test_schema.py::test_prefix[UserSchema] tests/test_schema.py::test_prefix[UserMetaSchema] tests/test_schema.py::test_fields_must_be_declared_as_instances tests/test_schema.py::test_serializing_generator[UserSchema] tests/test_schema.py::test_serializing_generator[UserMetaSchema] tests/test_schema.py::test_serializing_empty_list_returns_empty_list tests/test_schema.py::test_serializing_dict tests/test_schema.py::test_serializing_dict_with_meta_fields tests/test_schema.py::test_exclude_in_init[UserSchema] tests/test_schema.py::test_exclude_in_init[UserMetaSchema] tests/test_schema.py::test_only_in_init[UserSchema] tests/test_schema.py::test_only_in_init[UserMetaSchema] tests/test_schema.py::test_invalid_only_param tests/test_schema.py::test_can_serialize_uuid tests/test_schema.py::test_can_serialize_time tests/test_schema.py::test_invalid_time tests/test_schema.py::test_invalid_date tests/test_schema.py::test_invalid_dict_but_okay tests/test_schema.py::test_json_module_is_deprecated tests/test_schema.py::test_render_module tests/test_schema.py::test_custom_error_message tests/test_schema.py::test_load_errors_with_many tests/test_schema.py::test_error_raised_if_fields_option_is_not_list tests/test_schema.py::test_error_raised_if_additional_option_is_not_list tests/test_schema.py::test_nested_custom_set_in_exclude_reusing_schema tests/test_schema.py::test_nested_only tests/test_schema.py::test_nested_only_inheritance tests/test_schema.py::test_nested_only_empty_inheritance tests/test_schema.py::test_nested_exclude tests/test_schema.py::test_nested_exclude_inheritance tests/test_schema.py::test_nested_only_and_exclude tests/test_schema.py::test_nested_only_then_exclude_inheritance tests/test_schema.py::test_nested_exclude_then_only_inheritance tests/test_schema.py::test_nested_exclude_and_only_inheritance tests/test_schema.py::test_meta_nested_exclude tests/test_schema.py::test_nested_custom_set_not_implementing_getitem tests/test_schema.py::test_deeply_nested_only_and_exclude tests/test_schema.py::TestDeeplyNestedLoadOnly::test_load_only tests/test_schema.py::TestDeeplyNestedLoadOnly::test_dump_only tests/test_schema.py::TestDeeplyNestedListLoadOnly::test_load_only tests/test_schema.py::TestDeeplyNestedListLoadOnly::test_dump_only tests/test_schema.py::test_nested_constructor_only_and_exclude tests/test_schema.py::test_only_and_exclude tests/test_schema.py::test_exclude_invalid_attribute tests/test_schema.py::test_only_with_invalid_attribute tests/test_schema.py::test_only_bounded_by_fields tests/test_schema.py::test_only_empty tests/test_schema.py::test_nested_with_sets tests/test_schema.py::test_meta_serializer_fields tests/test_schema.py::test_meta_fields_mapping tests/test_schema.py::test_meta_field_not_on_obj_raises_attribute_error tests/test_schema.py::test_exclude_fields tests/test_schema.py::test_fields_option_must_be_list_or_tuple tests/test_schema.py::test_exclude_option_must_be_list_or_tuple tests/test_schema.py::test_dateformat_option tests/test_schema.py::test_default_dateformat tests/test_schema.py::test_inherit_meta tests/test_schema.py::test_inherit_meta_override tests/test_schema.py::test_additional tests/test_schema.py::test_cant_set_both_additional_and_fields tests/test_schema.py::test_serializing_none_meta tests/test_schema.py::TestHandleError::test_dump_with_custom_error_handler tests/test_schema.py::TestHandleError::test_load_with_custom_error_handler tests/test_schema.py::TestHandleError::test_load_with_custom_error_handler_and_partially_valid_data tests/test_schema.py::TestHandleError::test_custom_error_handler_with_validates_decorator tests/test_schema.py::TestHandleError::test_custom_error_handler_with_validates_schema_decorator tests/test_schema.py::TestHandleError::test_validate_with_custom_error_handler tests/test_schema.py::TestFieldValidation::test_errors_are_cleared_after_loading_collection tests/test_schema.py::TestFieldValidation::test_raises_error_with_list tests/test_schema.py::TestFieldValidation::test_raises_error_with_dict tests/test_schema.py::TestFieldValidation::test_ignored_if_not_in_only tests/test_schema.py::test_schema_repr tests/test_schema.py::TestNestedSchema::test_flat_nested tests/test_schema.py::TestNestedSchema::test_nested_many_with_missing_attribute tests/test_schema.py::TestNestedSchema::test_nested_with_attribute_none tests/test_schema.py::TestNestedSchema::test_flat_nested2 tests/test_schema.py::TestNestedSchema::test_nested_field_does_not_validate_required tests/test_schema.py::TestNestedSchema::test_nested_none tests/test_schema.py::TestNestedSchema::test_nested tests/test_schema.py::TestNestedSchema::test_nested_many_fields tests/test_schema.py::TestNestedSchema::test_nested_meta_many tests/test_schema.py::TestNestedSchema::test_nested_only tests/test_schema.py::TestNestedSchema::test_exclude tests/test_schema.py::TestNestedSchema::test_list_field tests/test_schema.py::TestNestedSchema::test_nested_load_many tests/test_schema.py::TestNestedSchema::test_nested_errors tests/test_schema.py::TestNestedSchema::test_nested_dump_errors tests/test_schema.py::TestNestedSchema::test_nested_dump tests/test_schema.py::TestNestedSchema::test_nested_method_field tests/test_schema.py::TestNestedSchema::test_nested_function_field tests/test_schema.py::TestNestedSchema::test_nested_prefixed_field tests/test_schema.py::TestNestedSchema::test_nested_prefixed_many_field tests/test_schema.py::TestNestedSchema::test_invalid_float_field tests/test_schema.py::TestNestedSchema::test_serializer_meta_with_nested_fields tests/test_schema.py::TestNestedSchema::test_serializer_with_nested_meta_fields tests/test_schema.py::TestNestedSchema::test_nested_fields_must_be_passed_a_serializer tests/test_schema.py::TestNestedSchema::test_invalid_type_passed_to_nested_field tests/test_schema.py::TestNestedSchema::test_all_errors_on_many_nested_field_with_validates_decorator tests/test_schema.py::TestNestedSchema::test_dump_validation_error tests/test_schema.py::TestSelfReference::test_nesting_schema_within_itself tests/test_schema.py::TestSelfReference::test_nesting_schema_by_passing_class_name tests/test_schema.py::TestSelfReference::test_nesting_within_itself_meta tests/test_schema.py::TestSelfReference::test_nested_self_with_only_param tests/test_schema.py::TestSelfReference::test_multiple_nested_self_fields tests/test_schema.py::TestSelfReference::test_nested_many tests/test_schema.py::test_serialization_with_required_field tests/test_schema.py::test_deserialization_with_required_field tests/test_schema.py::test_deserialization_with_required_field_and_custom_validator tests/test_schema.py::TestContext::test_context_method tests/test_schema.py::TestContext::test_context_method_function tests/test_schema.py::TestContext::test_function_field_raises_error_when_context_not_available tests/test_schema.py::TestContext::test_function_field_handles_bound_serializer tests/test_schema.py::TestContext::test_fields_context tests/test_schema.py::TestContext::test_nested_fields_inherit_context tests/test_schema.py::TestContext::test_nested_list_fields_inherit_context tests/test_schema.py::test_serializer_can_specify_nested_object_as_attribute tests/test_schema.py::TestFieldInheritance::test_inherit_fields_from_schema_subclass tests/test_schema.py::TestFieldInheritance::test_inherit_fields_from_non_schema_subclass tests/test_schema.py::TestFieldInheritance::test_inheritance_follows_mro tests/test_schema.py::TestGetAttribute::test_get_attribute_is_used tests/test_schema.py::TestGetAttribute::test_get_attribute_with_many tests/test_schema.py::TestRequiredFields::test_required_string_field_missing tests/test_schema.py::TestRequiredFields::test_required_string_field_failure tests/test_schema.py::TestRequiredFields::test_allow_none_param tests/test_schema.py::TestRequiredFields::test_allow_none_custom_message tests/test_schema.py::TestDefaults::test_missing_inputs_are_excluded_from_dump_output tests/test_schema.py::TestDefaults::test_none_is_serialized_to_none tests/test_schema.py::TestDefaults::test_default_and_value_missing tests/test_schema.py::TestDefaults::test_loading_none tests/test_schema.py::TestDefaults::test_missing_inputs_are_excluded_from_load_output tests/test_schema.py::TestLoadOnly::test_load_only tests/test_schema.py::TestLoadOnly::test_dump_only tests/test_schema.py::TestLoadOnly::test_url_field_requre_tld_false
marshmallow/fields.py
marshmallow/fields.py