About 80% of data is being served

This commit is contained in:
Adickes 2015-10-06 13:01:32 -04:00
parent 6d7fd53ece
commit df503e3424
9 changed files with 622 additions and 366 deletions

View file

@ -19,7 +19,7 @@ BASE_URL = 'http://pokeapi.co'
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['.pokeapi.co']
ALLOWED_HOSTS = ['.pokeapi.co', 'localhost']
TIME_ZONE = 'Europe/London'
@ -46,8 +46,6 @@ STATIC_ROOT = PROJECT_ROOT.child('assets')
STATIC_URL = '/assets/'
ALLOWED_HOSTS = ['localhost']
STATICFILES_DIRS = (
PROJECT_ROOT.child('assets'),
)

View file

@ -49,7 +49,10 @@ router = routers.DefaultRouter()
router.register(r"ability", AbilityResource)
router.register(r"berry", BerryResource)
router.register(r"berry-firmness", BerryFirmnessResource)
router.register(r"egg-group", EggGroupResource)
router.register(r"evolution-chain", EvolutionChainResource)
router.register(r"evolution-trigger", EvolutionTriggerResource)
router.register(r"generation", GenerationResource)
router.register(r"growth-rate", GrowthRateResource)
router.register(r"item", ItemResource)
@ -58,6 +61,7 @@ router.register(r"item-attribute", ItemFlagResource)
router.register(r"item-fling-effect", ItemFlingEffectResource)
router.register(r"item-pocket", ItemPocketResource)
router.register(r"language", LanguageResource)
router.register(r"location", LocationResource)
router.register(r"move", MoveResource)
router.register(r"move-ailment", MoveMetaAilmentResource)
router.register(r"move-category", MoveMetaCategoryResource)
@ -71,6 +75,7 @@ router.register(r"pokemon-habitat", PokemonHabitatResource)
router.register(r"pokemon-shape", PokemonShapeResource)
router.register(r"pokemon-species", PokemonSpeciesResource)
router.register(r"pokemon-color", PokemonColorResource)
router.register(r"pokemon-form", PokemonFormResource)
router.register(r"region", RegionResource)
router.register(r"stat", StatResource)
router.register(r"type", TypeResource)

View file

@ -1432,7 +1432,7 @@ for index, info in enumerate(data):
model = EvolutionChain (
id = int(info[0]),
baby_evolution_item = Item.objects.get(pk = int(info[1])) if info[1] != '' else None,
baby_trigger_item = Item.objects.get(pk = int(info[1])) if info[1] != '' else None,
)
model.save()

View file

@ -6,7 +6,7 @@ from django.db import models, migrations
class Migration(migrations.Migration):
# replaces = [(b'pokemon_v2', '0001_squashed_0005_auto_20150918_0502'), (b'pokemon_v2', '0002_auto_20150921_0054'), (b'pokemon_v2', '0003_auto_20150921_0437'), (b'pokemon_v2', '0004_auto_20150925_1521'), (b'pokemon_v2', '0005_auto_20150925_1527'), (b'pokemon_v2', '0006_auto_20150926_0832'), (b'pokemon_v2', '0007_auto_20150926_0850'), (b'pokemon_v2', '0008_auto_20150926_0855'), (b'pokemon_v2', '0009_auto_20150926_0858'), (b'pokemon_v2', '0010_auto_20150926_0900'), (b'pokemon_v2', '0011_auto_20150926_0905'), (b'pokemon_v2', '0012_auto_20150926_0907'), (b'pokemon_v2', '0013_auto_20150926_0913')]
# replaces = [(b'pokemon_v2', '0001_squashed_0013_auto_20150926_0913'), (b'pokemon_v2', '0002_itemflingeffect_name'), (b'pokemon_v2', '0003_auto_20150928_1710'), (b'pokemon_v2', '0004_auto_20151005_0138')]
dependencies = [
]
@ -1494,7 +1494,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('language', models.ForeignKey(related_name='pokemonhabitatname_language', blank=True, to='pokemon_v2.Language', null=True)),
('pokemon_habitat', models.ForeignKey(blank=True, to='pokemon_v2.PokemonHabitat', null=True)),
('pokemon_habitat', models.ForeignKey(related_name='pokemonhabitatname', blank=True, to='pokemon_v2.PokemonHabitat', null=True)),
],
options={
'abstract': False,
@ -2080,7 +2080,7 @@ class Migration(migrations.Migration):
),
migrations.AddField(
model_name='evolutionchain',
name='baby_evolution_item',
name='baby_trigger_item',
field=models.ForeignKey(blank=True, to='pokemon_v2.Item', null=True),
preserve_default=True,
),
@ -2910,4 +2910,10 @@ class Migration(migrations.Migration):
},
bases=(models.Model,),
),
migrations.AddField(
model_name='itemflingeffect',
name='name',
field=models.CharField(default='name', max_length=100),
preserve_default=False,
),
]

View file

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pokemon_v2', '0001_squashed_0013_auto_20150926_0913'),
]
operations = [
migrations.AddField(
model_name='itemflingeffect',
name='name',
field=models.CharField(default='name', max_length=100),
preserve_default=False,
),
]

View file

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pokemon_v2', '0002_itemflingeffect_name'),
]
operations = [
migrations.AlterField(
model_name='pokemonhabitatname',
name='pokemon_habitat',
field=models.ForeignKey(related_name='pokemonhabitatname', blank=True, to='pokemon_v2.PokemonHabitat', null=True),
preserve_default=True,
),
]

View file

@ -1110,7 +1110,7 @@ class SuperContestCombo(models.Model):
class EvolutionChain(models.Model):
baby_evolution_item = models.ForeignKey(Item, blank=True, null=True)
baby_trigger_item = models.ForeignKey(Item, blank=True, null=True)
class EvolutionTrigger(HasName):

File diff suppressed because it is too large Load diff

View file

@ -73,6 +73,13 @@ class BerryResource(PokeapiCommonViewset):
list_serializer_class = BerrySummarySerializer
class BerryFirmnessResource(PokeapiCommonViewset):
queryset = BerryFirmness.objects.all()
serializer_class = BerryFirmnessDetailSerializer
list_serializer_class = BerryFirmnessSummarySerializer
class EggGroupResource(PokeapiCommonViewset):
queryset = EggGroup.objects.all()
@ -80,6 +87,20 @@ class EggGroupResource(PokeapiCommonViewset):
list_serializer_class = EggGroupSummarySerializer
class EvolutionChainResource(PokeapiCommonViewset):
queryset = EvolutionChain.objects.all()
serializer_class = EvolutionChainDetailSerializer
list_serializer_class = EvolutionChainSummarySerializer
class EvolutionTriggerResource(PokeapiCommonViewset):
queryset = EvolutionTrigger.objects.all()
serializer_class = EvolutionTriggerDetailSerializer
list_serializer_class = EvolutionTriggerSummarySerializer
class GenerationResource(PokeapiCommonViewset):
queryset = Generation.objects.all()
@ -133,6 +154,14 @@ class LanguageResource(PokeapiCommonViewset):
queryset = Language.objects.all()
serializer_class = LanguageDetailSerializer
list_serializer_class = LanguageSummarySerializer
class LocationResource(PokeapiCommonViewset):
queryset = Location.objects.all()
serializer_class = LocationDetailSerializer
list_serializer_class = LocationSummarySerializer
class MoveResource(PokeapiCommonViewset):
@ -180,7 +209,8 @@ class MoveTargetResource(PokeapiCommonViewset):
class NatureResource(PokeapiCommonViewset):
queryset = Nature.objects.all()
serializer_class = NatureSerializer
serializer_class = NatureDetailSerializer
list_serializer_class = NatureSummarySerializer
class PokedexResource(PokeapiCommonViewset):
@ -197,6 +227,13 @@ class PokemonColorResource(PokeapiCommonViewset):
list_serializer_class = PokemonColorSummarySerializer
class PokemonFormResource(PokeapiCommonViewset):
queryset = PokemonForm.objects.all()
serializer_class = PokemonFormDetailSerializer
list_serializer_class = PokemonFormSummarySerializer
class PokemonHabitatResource(PokeapiCommonViewset):
queryset = PokemonHabitat.objects.all()
@ -220,7 +257,7 @@ class PokemonResource(PokeapiCommonViewset):
class PokemonSpeciesResource(PokeapiCommonViewset):
queryset = PokemonSpecies.objects.all()
queryset = PokemonSpecies.objects.all().order_by('id')
serializer_class = PokemonSpeciesDetailSerializer
list_serializer_class = PokemonSpeciesSummarySerializer