mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Fix NotImplementedError for Field.to_internal_value and Field.to_representation (#6996)
This commit is contained in:
		
							parent
							
								
									b8c369c4cf
								
							
						
					
					
						commit
						3c1428ff79
					
				| 
						 | 
					@ -605,8 +605,11 @@ class Field:
 | 
				
			||||||
        Transform the *incoming* primitive data into a native value.
 | 
					        Transform the *incoming* primitive data into a native value.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        raise NotImplementedError(
 | 
					        raise NotImplementedError(
 | 
				
			||||||
            '{cls}.to_internal_value() must be implemented.'.format(
 | 
					            '{cls}.to_internal_value() must be implemented for field '
 | 
				
			||||||
                cls=self.__class__.__name__
 | 
					            '{field_name}. If you do not need to support write operations '
 | 
				
			||||||
 | 
					            'you probably want to subclass `ReadOnlyField` instead.'.format(
 | 
				
			||||||
 | 
					                cls=self.__class__.__name__,
 | 
				
			||||||
 | 
					                field_name=self.field_name,
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -615,9 +618,7 @@ class Field:
 | 
				
			||||||
        Transform the *outgoing* native value into primitive data.
 | 
					        Transform the *outgoing* native value into primitive data.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        raise NotImplementedError(
 | 
					        raise NotImplementedError(
 | 
				
			||||||
            '{cls}.to_representation() must be implemented for field '
 | 
					            '{cls}.to_representation() must be implemented for field {field_name}.'.format(
 | 
				
			||||||
            '{field_name}. If you do not need to support write operations '
 | 
					 | 
				
			||||||
            'you probably want to subclass `ReadOnlyField` instead.'.format(
 | 
					 | 
				
			||||||
                cls=self.__class__.__name__,
 | 
					                cls=self.__class__.__name__,
 | 
				
			||||||
                field_name=self.field_name,
 | 
					                field_name=self.field_name,
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user