mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-10 06:04:18 +00:00
more ability stuff
This commit is contained in:
parent
7a7c2d9737
commit
d9720665b8
6 changed files with 86 additions and 23 deletions
|
@ -7,6 +7,8 @@ from pokemon_v2.models import *
|
|||
# ABILITIES #
|
||||
###############
|
||||
|
||||
# Names #
|
||||
|
||||
file = open('data/v2/csv/ability_names.csv', 'rb')
|
||||
data = csv.reader(file, delimiter=',')
|
||||
|
||||
|
@ -14,30 +16,25 @@ for index, info in enumerate(data):
|
|||
if index > 0:
|
||||
|
||||
abilityName = AbilityName(
|
||||
id=int(info[0]),
|
||||
ability_id=int(info[1]),
|
||||
local_language_id=int(info[2]),
|
||||
name=str(info[3]),
|
||||
ability_id=int(info[0]),
|
||||
local_language_id=int(info[1]),
|
||||
name=info[2]
|
||||
)
|
||||
abilityName.save()
|
||||
print 'created ' % abilityName.name
|
||||
|
||||
|
||||
# for filename in os.listdir('data/v2/csv'):
|
||||
# Descriptions #
|
||||
|
||||
# print filename
|
||||
file = open('data/v2/csv/ability_prose.csv', 'rb')
|
||||
data = csv.reader(file, delimiter=',')
|
||||
|
||||
# file = open('csv/ability_names.csv', 'rb')
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
# types_reader = csv.reader(file, delimiter=',')
|
||||
|
||||
# for row in types_reader:
|
||||
|
||||
# new_type = Type(
|
||||
# id = row[0],
|
||||
# name = row[1],
|
||||
# generation_id = row[2],
|
||||
# damage_class_id = row[3]
|
||||
# )
|
||||
|
||||
# print new_type
|
||||
abilityDesc = AbilityDescription(
|
||||
ability_id=int(info[0]),
|
||||
local_language_id=int(info[1]),
|
||||
short_effect=info[2],
|
||||
effect=info[3]
|
||||
)
|
||||
abilityDesc.save()
|
||||
|
|
|
@ -29,7 +29,7 @@ class Migration(migrations.Migration):
|
|||
('ability_id', models.IntegerField()),
|
||||
('local_language_id', models.IntegerField()),
|
||||
('short_effect', models.CharField(max_length=200)),
|
||||
('effect', models.CharField(max_length=1000)),
|
||||
('effect', models.CharField(max_length=2000)),
|
||||
],
|
||||
options={
|
||||
},
|
||||
|
|
20
pokemon_v2/migrations/0002_auto_20150403_0536.py
Normal file
20
pokemon_v2/migrations/0002_auto_20150403_0536.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='abilitydescription',
|
||||
name='effect',
|
||||
field=models.CharField(max_length=2001),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
20
pokemon_v2/migrations/0003_auto_20150403_0533.py
Normal file
20
pokemon_v2/migrations/0003_auto_20150403_0533.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0002_auto_20150403_0522'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='abilitydescription',
|
||||
name='effect',
|
||||
field=models.CharField(max_length=2001),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
26
pokemon_v2/migrations/0003_auto_20150403_1259.py
Normal file
26
pokemon_v2/migrations/0003_auto_20150403_1259.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0002_auto_20150403_0536'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='abilitydescription',
|
||||
name='effect',
|
||||
field=models.CharField(max_length=2000),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='abilitydescription',
|
||||
name='short_effect',
|
||||
field=models.CharField(max_length=300),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
|
@ -8,9 +8,9 @@ class AbilityDescription(models.Model):
|
|||
|
||||
local_language_id = models.IntegerField()
|
||||
|
||||
short_effect = models.CharField(max_length=200)
|
||||
short_effect = models.CharField(max_length=300)
|
||||
|
||||
effect = models.CharField(max_length=1000)
|
||||
effect = models.CharField(max_length=2000)
|
||||
|
||||
|
||||
class AbilityFlavorText(models.Model):
|
||||
|
|
Loading…
Reference in a new issue