Changes between Initial Version and Version 1 of Ticket #14438, comment 3
- Timestamp:
- Nov 30, 2011, 8:32:35 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #14438, comment 3
initial v1 8 8 9 9 Second, I manually deserialized json file and got the same ValidationError. 10 10 {{{ 11 11 >>> f = open('/home/dima/djprojects/mysite/places/data/data_chunk.json', 'r') 12 12 >>> for object in serializers.deserialize('json', f): … … 24 24 raise exceptions.ValidationError(self.error_messages['invalid']) 25 25 ValidationError: [u'This value must be an integer.'] 26 26 }}} 27 27 I have verified that my natural_key() model method is returning a tuple, but this did not fix the bug. 28 28 {{{ 29 #!python 29 30 class MenuCategoryManager(models.Manager): 30 31 def get_by_natural_key(self, category): … … 38 39 def natural_key(self): 39 40 return (self.category,) 40 41 }}} 41 42 Only when I added [] to the value in json file (where key was referring to the ForeignKey relationship) the Error resolved. 42 43 43 44 So, I was get ValidationError with this json 44 45 {{{ 45 46 "menu_category": "Холодные закуски и салаты", 46 47 }}} 47 48 And no ValidationError with this json 48 49 {{{ 49 50 "menu_category": [ 50 51 "Холодные закуски и салаты" 51 52 ], 53 }}}