python - 'int' object has no attribute 'replace' loading initial data in django -


i trying familiar loading initial data in model loaddata. json looks this:

[   {     "model": "locations.location",     "pk": 1,     "fields": {       "name": "cafe"     }   } ] 

my model.py:

class location(models.model):     id = models.uuidfield(primary_key=true, default=uuid.uuid4)     create_date = models.datetimefield('date added', auto_now_add=true)     modify_date = models.datetimefield('date modified', default=timezone.now)     name = models.charfield(max_length=200) 

and when python manage.py loaddata mydata

django.core.serializers.base.deserializationerror: problem installing fixture '/path/to/locations/fixtures/mydata.json': 'int' object has no attribute 'replace'

what mean? tried changing in models.py

def __unicode__(self):     return self.name 

to

def __unicode__(self):     return self.name.get_full_name()  

but didn't work. int object?

more traceback:

 file "manage.py", line 10, in <module>     execute_from_command_line(sys.argv)   file "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 338, in execute_from_command_line     utility.execute()   file "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 330, in execute     self.fetch_command(subcommand).run_from_argv(self.argv)   file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 390, in run_from_argv     self.execute(*args, **cmd_options)   file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 441, in execute     output = self.handle(*args, **options)   file "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/loaddata.py", line 60, in handle     self.loaddata(fixture_labels)   file "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/loaddata.py", line 90, in loaddata     self.load_label(fixture_label)   file "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/loaddata.py", line 141, in load_label     obj in objects:   file "/usr/local/lib/python2.7/dist-packages/django/core/serializers/json.py", line 84, in deserializer     six.reraise(deserializationerror, deserializationerror(e), sys.exc_info()[2])   file "/usr/local/lib/python2.7/dist-packages/django/core/serializers/json.py", line 78, in deserializer     obj in pythondeserializer(objects, **options):   file "/usr/local/lib/python2.7/dist-packages/django/core/serializers/python.py", line 104, in deserializer     data[model._meta.pk.attname] = model._meta.pk.to_python(d.get("pk", none))   file "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py", line 2404, in to_python     return uuid.uuid(value)   file "/usr/lib/python2.7/uuid.py", line 131, in __init__     hex = hex.replace('urn:', '').replace('uuid:', '') 

this works comments:

[   {     "model": "locations.location",     "fields": {         "id":"a3184190-0b97-4c56-8aac-eeee8875aaa2",         "name": "cafe"     }   } ] 

Comments