Problem loading integer data into database using fixture
Hello All,
I'm attempting to provide initial data for my database using a fixture
file (like this: https://docs.djangoproject.com/en/1.3/howto/initial-data/#providing-initial-data-with-fixtures),
but I'm running into the following error:
Problem installing fixture '/home/guillaume/NBA/players/fixtures/
player_data.yaml': Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/management/
commands/loaddata.py", line 169, in handle
for obj in objects:
File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/
pyyaml.py", line 54, in Deserializer
for obj in PythonDeserializer(yaml.load(stream), **options):
File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/
python.py", line 122, in Deserializer
data[field.attname] =
field.rel.to._meta.get_field(field.rel.field_name).to_python(field_value)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/
__init__.py", line 471, in to_python
raise exceptions.ValidationError(self.error_messages['invalid'])
ValidationError: [u'This value must be an integer.']
Here is a sample from the YAML fixture file I'm attempting to use:
- model: players.player
pk: 2
fields:
team: DEN
first_name: Arron
last_name: Afflalo
age: 26
pos: SG
gp: 25
mp: 754
fg: 98
fga: 227
ft: 62
fta: 78
three_pointers: 31
threes_attempted: 81
orb: 15
drb: 51
ast: 39
stl: 15
blk: 6
tov: 33
pf: 55
pts: 289
Isn't what I have there mostly integers? I've already checked my
models.py file to make sure I didn't accidentally use an
"IntegerField" for "team", "first_name", "last_name", or "pos." Do I
need to include some other kind of formatting information in my YAML
file to indicate that the numbers are integers?
thanks,
Guillaume
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home