mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-22 11:23:13 +00:00
ability stuff
This commit is contained in:
parent
9938788abb
commit
7a7c2d9737
6 changed files with 176 additions and 116 deletions
|
@ -8,7 +8,7 @@ DEBUG = False
|
|||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = (
|
||||
('Paul Hallett', 'paulandrewhallett@gmail.com'),
|
||||
('Zane Adickes', 'zaneadix@gmail.com'),
|
||||
)
|
||||
|
||||
MANAGERS = ADMINS
|
||||
|
@ -83,7 +83,7 @@ DATABASES = {
|
|||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'pokeapi_co_db',
|
||||
'USER': 'root',
|
||||
'USER': 'zane',
|
||||
'PASSWORD': 'pokeapi',
|
||||
'HOST': 'localhost',
|
||||
'PORT': '',
|
||||
|
@ -108,7 +108,7 @@ SECRET_KEY = os.environ.get(
|
|||
|
||||
CUSTOM_APPS = (
|
||||
'tastypie',
|
||||
'pokemon',
|
||||
'pokemon_v2',
|
||||
'hits',
|
||||
)
|
||||
INSTALLED_APPS = (
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
from build import *
|
43
data/v2/build.py
Normal file
43
data/v2/build.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
import csv
|
||||
import os
|
||||
|
||||
from pokemon_v2.models import *
|
||||
|
||||
###############
|
||||
# ABILITIES #
|
||||
###############
|
||||
|
||||
file = open('data/v2/csv/ability_names.csv', 'rb')
|
||||
data = csv.reader(file, delimiter=',')
|
||||
|
||||
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]),
|
||||
)
|
||||
abilityName.save()
|
||||
print 'created ' % abilityName.name
|
||||
|
||||
|
||||
# for filename in os.listdir('data/v2/csv'):
|
||||
|
||||
# print filename
|
||||
|
||||
# file = open('csv/ability_names.csv', 'rb')
|
||||
|
||||
# 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
|
|
@ -1,4 +1,9 @@
|
|||
from __future__ import unicode_literals
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
from .models import *
|
||||
|
||||
admin.site.register(Ability)
|
||||
admin.site.register(AbilityName)
|
||||
admin.site.register(AbilityDescription)
|
||||
admin.site.register(AbilityFlavorText)
|
||||
|
|
81
pokemon_v2/migrations/0001_initial.py
Normal file
81
pokemon_v2/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,81 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Ability',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('generation', models.IntegerField()),
|
||||
('is_main_series', models.IntegerField()),
|
||||
('name', models.CharField(max_length=30)),
|
||||
],
|
||||
options={
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='AbilityDescription',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('ability_id', models.IntegerField()),
|
||||
('local_language_id', models.IntegerField()),
|
||||
('short_effect', models.CharField(max_length=200)),
|
||||
('effect', models.CharField(max_length=1000)),
|
||||
],
|
||||
options={
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='AbilityFlavorText',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('ability_id', models.IntegerField()),
|
||||
('version_group_id', models.IntegerField()),
|
||||
('language_id', models.IntegerField()),
|
||||
('flavor_text', models.CharField(max_length=100)),
|
||||
],
|
||||
options={
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='AbilityName',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('ability_id', models.IntegerField()),
|
||||
('local_language_id', models.IntegerField()),
|
||||
('name', models.CharField(max_length=30)),
|
||||
],
|
||||
options={
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='ability',
|
||||
name='description',
|
||||
field=models.OneToOneField(null=True, blank=True, to='pokemon_v2.AbilityDescription'),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='ability',
|
||||
name='flavor_text',
|
||||
field=models.ForeignKey(blank=True, to='pokemon_v2.AbilityFlavorText', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='ability',
|
||||
name='names',
|
||||
field=models.ForeignKey(blank=True, to='pokemon_v2.AbilityName', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
|
@ -1,122 +1,52 @@
|
|||
from __future__ import unicode_literals
|
||||
from django.db import models
|
||||
|
||||
class Ability(models.Model):
|
||||
|
||||
id = models.IntegerField()
|
||||
class AbilityDescription(models.Model):
|
||||
|
||||
ability_id = models.IntegerField()
|
||||
|
||||
local_language_id = models.IntegerField()
|
||||
|
||||
short_effect = models.CharField(max_length=200)
|
||||
|
||||
effect = models.CharField(max_length=1000)
|
||||
|
||||
|
||||
class AbilityFlavorText(models.Model):
|
||||
|
||||
ability_id = models.IntegerField()
|
||||
|
||||
version_group_id = models.IntegerField()
|
||||
|
||||
language_id = models.IntegerField()
|
||||
|
||||
flavor_text = models.CharField(max_length=100)
|
||||
|
||||
|
||||
class AbilityName(models.Model):
|
||||
|
||||
ability_id = models.IntegerField()
|
||||
|
||||
local_language_id = models.IntegerField()
|
||||
|
||||
name = models.CharField(max_length=30)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
return self.name
|
||||
|
||||
|
||||
class Ability(models.Model):
|
||||
|
||||
flavor_text = models.ForeignKey(AbilityFlavorText, blank=True, null=True)
|
||||
|
||||
generation = models.IntegerField()
|
||||
|
||||
is_main_series = models.IntegerField()
|
||||
|
||||
|
||||
|
||||
class EggGroups(models.Model):
|
||||
|
||||
id = models.IntegerField()
|
||||
description = models.OneToOneField(AbilityDescription, blank=True, null=True)
|
||||
|
||||
name = models.CharField(max_length=30)
|
||||
|
||||
|
||||
|
||||
class Gender(model.Models):
|
||||
|
||||
id = models.IntegerField()
|
||||
|
||||
name = models.CharField(max_length=12)
|
||||
|
||||
|
||||
|
||||
class Generation(models.Model):
|
||||
|
||||
id = models.IntegerField()
|
||||
|
||||
main_region_id = models.IntegerField()
|
||||
|
||||
name = models.CharField(max_length=30)
|
||||
|
||||
|
||||
|
||||
class Move
|
||||
|
||||
id = models.IntegerField()
|
||||
|
||||
name = models.CharField(max_length=30)
|
||||
|
||||
generaion_id = models.IntegerField()
|
||||
|
||||
type_id = models.IntegerField()
|
||||
|
||||
power = models.IntegerField()
|
||||
|
||||
pp = models.IntegerField()
|
||||
|
||||
accuracy = models.IntegerField()
|
||||
|
||||
priority = models.IntegerField()
|
||||
|
||||
target_id = models.IntegerField()
|
||||
|
||||
damage_class_id = models.IntegerField()
|
||||
|
||||
effect_id = models.IntegerField()
|
||||
|
||||
effect_chance = models.IntegerField()
|
||||
|
||||
contest_type_id = models.IntegerField()
|
||||
|
||||
contest_effect_id = models.IntegerField()
|
||||
|
||||
super_contest+effect_id = models.IntegerField()
|
||||
|
||||
|
||||
|
||||
class Nature(models.Model):
|
||||
|
||||
id = models.IntegerField()
|
||||
|
||||
name = CharField(max_length=30)
|
||||
|
||||
decreased_stat_id = models.IntegerField()
|
||||
|
||||
increased_stat_id = models.IntegerField()
|
||||
|
||||
hates_flavor_id = models.IntegerField()
|
||||
|
||||
likes_flavor_id = models.IntegerField()
|
||||
|
||||
game_index = models.IntegerField()
|
||||
|
||||
|
||||
|
||||
class Pokedex(models.Model):
|
||||
|
||||
id = models.IntegerField()
|
||||
|
||||
region_id = models.IntegerField()
|
||||
|
||||
name = models.CharField(max_length=30)
|
||||
|
||||
is_main_series = models.IntegerField()
|
||||
|
||||
|
||||
|
||||
class Pokemon(models.Model):
|
||||
|
||||
id = models.IntegerField()
|
||||
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
species_id = models.IntegerField()
|
||||
|
||||
height = models.CharField(max_length=10)
|
||||
|
||||
weight = models.CharField(max_length=10)
|
||||
|
||||
base_experience = models.IntegerField()
|
||||
|
||||
order = models.IntegerField()
|
||||
|
||||
is_default = models.IntegerField()
|
||||
names = models.ForeignKey(AbilityName, blank=True, null=True)
|
||||
|
|
Loading…
Reference in a new issue