Changes between Initial Version and Version 1 of Ticket #14438, comment 3


Ignore:
Timestamp:
11/30/2011 08:32:35 AM (4 years ago)
Author:
kmtracey
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14438, comment 3

    initial v1  
    88
    99Second, I manually deserialized json file and got the same ValidationError.
    10 
     10{{{
    1111>>> f = open('/home/dima/djprojects/mysite/places/data/data_chunk.json', 'r')
    1212>>> for object in serializers.deserialize('json', f):
     
    2424    raise exceptions.ValidationError(self.error_messages['invalid'])
    2525ValidationError: [u'This value must be an integer.']
    26 
     26}}}
    2727I have verified that my natural_key() model method is returning a tuple, but this did not fix the bug.
    28 
     28{{{
     29#!python
    2930class MenuCategoryManager(models.Manager):
    3031    def get_by_natural_key(self, category):
     
    3839    def natural_key(self):
    3940        return (self.category,)
    40 
     41}}}
    4142Only when I added [] to the value in json file (where key was referring to the ForeignKey relationship) the Error resolved.
    4243
    4344So, I was get ValidationError with this json
    44 
     45{{{
    4546        "menu_category": "Холодные закуски и салаты",
    46 
     47}}}
    4748And no ValidationError with this json
    48 
     49{{{
    4950        "menu_category": [
    5051            "Холодные закуски и салаты"
    5152        ],
     53}}}
Back to Top