diff options
| author | Tom Christie | 2014-09-12 11:38:22 +0100 |
|---|---|---|
| committer | Tom Christie | 2014-09-12 11:38:22 +0100 |
| commit | 5e39e159ee6aee90755709cfecec7d22c7ea3049 (patch) | |
| tree | 2421651bc6b329fc134ed770b1c24fc1a496ae9d /rest_framework/fields.py | |
| parent | 250755def707e1397876614fa0c08130d9fcc449 (diff) | |
| download | django-rest-framework-5e39e159ee6aee90755709cfecec7d22c7ea3049.tar.bz2 | |
UNICODE_JSON and COMPACT_JSON settings
Diffstat (limited to 'rest_framework/fields.py')
| -rw-r--r-- | rest_framework/fields.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 4f06d186..9d96cf5c 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -137,6 +137,16 @@ class Field(object): messages.update(error_messages or {}) self.error_messages = messages + def __new__(cls, *args, **kwargs): + """ + When a field is instantiated, we store the arguments that were used, + so that we can present a helpful representation of the object. + """ + instance = super(Field, cls).__new__(cls) + instance._args = args + instance._kwargs = kwargs + return instance + def bind(self, field_name, parent, root): """ Setup the context for the field instance. @@ -249,16 +259,6 @@ class Field(object): raise AssertionError(msg) raise ValidationError(msg.format(**kwargs)) - def __new__(cls, *args, **kwargs): - """ - When a field is instantiated, we store the arguments that were used, - so that we can present a helpful representation of the object. - """ - instance = super(Field, cls).__new__(cls) - instance._args = args - instance._kwargs = kwargs - return instance - def __repr__(self): return representation.field_repr(self) |
