MCPcopy Index your code
hub / github.com/encode/django-rest-framework / __init__

Method __init__

rest_framework/fields.py:1943–1952  ·  view source on GitHub ↗
(self, model_field, **kwargs)

Source from the content-addressed store, hash-verified

1941 }
1942
1943 def __init__(self, model_field, **kwargs):
1944 self.model_field = model_field
1945 # The `max_length` option is supported by Django's base `Field` class,
1946 # so we'd better support it here.
1947 self.max_length = kwargs.pop('max_length', None)
1948 super().__init__(**kwargs)
1949 if self.max_length is not None:
1950 message = lazy_format(self.error_messages['max_length'], max_length=self.max_length)
1951 self.validators.append(
1952 MaxLengthValidator(self.max_length, message=message))
1953
1954 def to_internal_value(self, data):
1955 rel = self.model_field.remote_field

Callers

nothing calls this directly

Calls 2

lazy_formatClass · 0.90
__init__Method · 0.45

Tested by

no test coverage detected