From dbc7895934ae03b75b5a1632022d936d477967e9 Mon Sep 17 00:00:00 2001 From: phalt Date: Mon, 15 Dec 2014 10:13:52 +0000 Subject: [PATCH] remove xml for now --- Makefile | 3 +-- config/settings.py | 2 +- config/urls.py | 2 +- config/views.py | 2 +- pokemon/admin.py | 2 +- pokemon/fixtures/dev_data.json | 2 +- pokemon/migrations/0001_initial.py | 30 +++++++++++++++--------------- pokemon_v2/tests.py | 3 +-- requirements.txt | 2 +- 9 files changed, 23 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index dddd063a..c8030b98 100755 --- a/Makefile +++ b/Makefile @@ -12,8 +12,7 @@ serve: python manage.py runserver --settings=config.local test: - python manage.py test pokemon_v1 --settings=config.local - python manage.py test pokemon_v2 --settings=config.local + python manage.py test --settings=config.local clean: rm -rf *.pyc diff --git a/config/settings.py b/config/settings.py index f176f122..49e20cbe 100755 --- a/config/settings.py +++ b/config/settings.py @@ -125,7 +125,7 @@ INSTALLED_APPS = ( API_LIMIT_PER_PAGE = 1 -TASTYPIE_DEFAULT_FORMATS = ['json', 'xml'] +TASTYPIE_DEFAULT_FORMATS = ['json'] CORS_ORIGIN_ALLOW_ALL = True CORS_ALLOW_METHODS = ( diff --git a/config/urls.py b/config/urls.py index 2838a80a..1d347fe1 100755 --- a/config/urls.py +++ b/config/urls.py @@ -12,7 +12,7 @@ admin.autodiscover() # API v1 -from pokemon_v1.api import ( +from pokemon.api import ( PokemonResource, TypeResource, AbilityResource, GameResource, SpriteResource, DescriptionResource, EggResource, MoveResource, PokedexResource diff --git a/config/views.py b/config/views.py index 7f989755..3454f27a 100755 --- a/config/views.py +++ b/config/views.py @@ -5,7 +5,7 @@ from django.shortcuts import render_to_response from django.template import RequestContext from django.contrib.auth.decorators import login_required -from pokemon_v1.models import ( +from pokemon.models import ( Pokemon, Sprite, Move, Description, Game, EggGroup, Type, Ability, MovePokemon ) diff --git a/pokemon/admin.py b/pokemon/admin.py index 798ea0f7..2d035705 100755 --- a/pokemon/admin.py +++ b/pokemon/admin.py @@ -1,5 +1,5 @@ from __future__ import unicode_literals -from pokemon_v1.models import ( +from .models import ( Pokemon, Sprite, Move, Description, Game, EggGroup, Type, Ability, Evolution, MovePokemon, TypeChart, Pokedex diff --git a/pokemon/fixtures/dev_data.json b/pokemon/fixtures/dev_data.json index d44907cf..7d7d08c6 100755 --- a/pokemon/fixtures/dev_data.json +++ b/pokemon/fixtures/dev_data.json @@ -1 +1 @@ -[{"pk": 1, "model": "pokemon_v1.ability", "fields": {"description": "You do not want to know", "modified": "2014-07-28T21:25:21.039Z", "name": "Harden", "created": "2014-07-28T21:25:21.039Z"}}, {"pk": 1, "model": "pokemon_v1.type", "fields": {"modified": "2014-07-28T21:22:38.583Z", "name": "Fire", "created": "2014-07-28T21:22:38.583Z"}}, {"pk": 2, "model": "pokemon_v1.type", "fields": {"modified": "2014-07-28T21:22:41.821Z", "name": "Water", "created": "2014-07-28T21:22:41.821Z"}}, {"pk": 1, "model": "pokemon_v1.typechart", "fields": {"to": 2, "ttype": "weak", "modified": "2014-07-28T21:22:57.494Z", "frm": 1, "created": "2014-07-28T21:22:57.494Z"}}, {"pk": 2, "model": "pokemon_v1.typechart", "fields": {"to": 1, "ttype": "super effective", "modified": "2014-07-28T21:23:04.357Z", "frm": 2, "created": "2014-07-28T21:23:04.357Z"}}, {"pk": 1, "model": "pokemon_v1.egggroup", "fields": {"modified": "2014-07-28T21:24:49.363Z", "name": "Fairy", "created": "2014-07-28T21:24:49.363Z"}}, {"pk": 1, "model": "pokemon_v1.game", "fields": {"generation": 1, "release_year": 1995, "modified": "2014-07-28T21:24:35.166Z", "name": "Red", "created": "2014-07-28T21:24:35.166Z"}}, {"pk": 1, "model": "pokemon_v1.description", "fields": {"description": "This Pokemon is basically a weird plant thing", "game": [1], "modified": "2014-07-28T21:25:08.358Z", "name": "bulbasaur_red", "created": "2014-07-28T21:25:08.358Z"}}, {"pk": 2, "model": "pokemon_v1.description", "fields": {"description": "This pokemon looks even stranger", "game": [1], "modified": "2014-07-28T21:26:52.222Z", "name": "ivysaur_red", "created": "2014-07-28T21:26:52.222Z"}}, {"pk": 1, "model": "pokemon_v1.move", "fields": {"category": "physical", "pp": 5, "description": "A basic tackle attack", "power": 10, "created": "2014-07-28T21:24:05.045Z", "modified": "2014-07-28T21:24:05.045Z", "etype": [1], "accuracy": 100, "name": "Tackle"}}, {"pk": 2, "model": "pokemon_v1.move", "fields": {"category": "special", "pp": 10, "description": "The pokemon blows bubbles", "power": 40, "created": "2014-07-28T21:24:25.895Z", "modified": "2014-07-28T21:24:25.895Z", "etype": [2], "accuracy": 90, "name": "Bubble"}}, {"pk": 1, "model": "pokemon_v1.pokemon", "fields": {"egg_cycles": 20, "abilities": [1], "weight": "20", "height": "7", "defense": 20, "sp_atk": 20, "descriptions": [1], "ev_yield": "1", "total": 20, "speed": 20, "species": "plant Pokemon", "happiness": 1, "attack": 20, "egg_group": [1], "growth_rate": "slow", "pkdx_id": 1, "hp": 45, "catch_rate": 1, "sp_def": 20, "types": [1], "name": "Bulbasaur", "created": "2014-07-28T21:26:02.384Z", "modified": "2014-07-28T21:26:02.384Z", "male_female_ratio": "10/90", "exp": 1, "sprites": []}}, {"pk": 2, "model": "pokemon_v1.pokemon", "fields": {"egg_cycles": 30, "abilities": [1], "weight": "29", "height": "13", "defense": 30, "sp_atk": 30, "descriptions": [2], "ev_yield": "20", "total": 30, "speed": 30, "species": "fairy", "happiness": 20, "attack": 30, "egg_group": [1], "growth_rate": "medium slow", "pkdx_id": 2, "hp": 100, "catch_rate": 20, "sp_def": 30, "types": [2], "name": "Ivysaur", "created": "2014-07-28T21:26:55.346Z", "modified": "2014-07-28T21:26:55.346Z", "male_female_ratio": "50/50", "exp": 20, "sprites": []}}, {"pk": 1, "model": "pokemon_v1.pokedex", "fields": {"modified": "2014-07-28T21:23:36.753Z", "name": "National", "created": "2014-07-28T21:23:36.754Z"}}] +[{"pk": 1, "model": "pokemon.ability", "fields": {"description": "You do not want to know", "modified": "2014-07-28T21:25:21.039Z", "name": "Harden", "created": "2014-07-28T21:25:21.039Z"}}, {"pk": 1, "model": "pokemon.type", "fields": {"modified": "2014-07-28T21:22:38.583Z", "name": "Fire", "created": "2014-07-28T21:22:38.583Z"}}, {"pk": 2, "model": "pokemon.type", "fields": {"modified": "2014-07-28T21:22:41.821Z", "name": "Water", "created": "2014-07-28T21:22:41.821Z"}}, {"pk": 1, "model": "pokemon.typechart", "fields": {"to": 2, "ttype": "weak", "modified": "2014-07-28T21:22:57.494Z", "frm": 1, "created": "2014-07-28T21:22:57.494Z"}}, {"pk": 2, "model": "pokemon.typechart", "fields": {"to": 1, "ttype": "super effective", "modified": "2014-07-28T21:23:04.357Z", "frm": 2, "created": "2014-07-28T21:23:04.357Z"}}, {"pk": 1, "model": "pokemon.egggroup", "fields": {"modified": "2014-07-28T21:24:49.363Z", "name": "Fairy", "created": "2014-07-28T21:24:49.363Z"}}, {"pk": 1, "model": "pokemon.game", "fields": {"generation": 1, "release_year": 1995, "modified": "2014-07-28T21:24:35.166Z", "name": "Red", "created": "2014-07-28T21:24:35.166Z"}}, {"pk": 1, "model": "pokemon.description", "fields": {"description": "This Pokemon is basically a weird plant thing", "game": [1], "modified": "2014-07-28T21:25:08.358Z", "name": "bulbasaur_red", "created": "2014-07-28T21:25:08.358Z"}}, {"pk": 2, "model": "pokemon.description", "fields": {"description": "This pokemon looks even stranger", "game": [1], "modified": "2014-07-28T21:26:52.222Z", "name": "ivysaur_red", "created": "2014-07-28T21:26:52.222Z"}}, {"pk": 1, "model": "pokemon.move", "fields": {"category": "physical", "pp": 5, "description": "A basic tackle attack", "power": 10, "created": "2014-07-28T21:24:05.045Z", "modified": "2014-07-28T21:24:05.045Z", "etype": [1], "accuracy": 100, "name": "Tackle"}}, {"pk": 2, "model": "pokemon.move", "fields": {"category": "special", "pp": 10, "description": "The pokemon blows bubbles", "power": 40, "created": "2014-07-28T21:24:25.895Z", "modified": "2014-07-28T21:24:25.895Z", "etype": [2], "accuracy": 90, "name": "Bubble"}}, {"pk": 1, "model": "pokemon.pokemon", "fields": {"egg_cycles": 20, "abilities": [1], "weight": "20", "height": "7", "defense": 20, "sp_atk": 20, "descriptions": [1], "ev_yield": "1", "total": 20, "speed": 20, "species": "plant Pokemon", "happiness": 1, "attack": 20, "egg_group": [1], "growth_rate": "slow", "pkdx_id": 1, "hp": 45, "catch_rate": 1, "sp_def": 20, "types": [1], "name": "Bulbasaur", "created": "2014-07-28T21:26:02.384Z", "modified": "2014-07-28T21:26:02.384Z", "male_female_ratio": "10/90", "exp": 1, "sprites": []}}, {"pk": 2, "model": "pokemon.pokemon", "fields": {"egg_cycles": 30, "abilities": [1], "weight": "29", "height": "13", "defense": 30, "sp_atk": 30, "descriptions": [2], "ev_yield": "20", "total": 30, "speed": 30, "species": "fairy", "happiness": 20, "attack": 30, "egg_group": [1], "growth_rate": "medium slow", "pkdx_id": 2, "hp": 100, "catch_rate": 20, "sp_def": 30, "types": [2], "name": "Ivysaur", "created": "2014-07-28T21:26:55.346Z", "modified": "2014-07-28T21:26:55.346Z", "male_female_ratio": "50/50", "exp": 20, "sprites": []}}, {"pk": 1, "model": "pokemon.pokedex", "fields": {"modified": "2014-07-28T21:23:36.753Z", "name": "National", "created": "2014-07-28T21:23:36.754Z"}}] diff --git a/pokemon/migrations/0001_initial.py b/pokemon/migrations/0001_initial.py index 9c30e088..e575ae4a 100644 --- a/pokemon/migrations/0001_initial.py +++ b/pokemon/migrations/0001_initial.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals from django.db import models, migrations import imagekit.models.fields -import pokemon_v1.utils +import pokemon.utils class Migration(migrations.Migration): @@ -109,7 +109,7 @@ class Migration(migrations.Migration): ('created', models.DateTimeField(auto_now_add=True)), ('learn_type', models.CharField(default=b'level up', max_length=15, choices=[(b'level up', b'level up'), (b'machine', b'machine'), (b'egg move', b'egg move'), (b'tutor', b'tutor'), (b'other', b'other')])), ('level', models.IntegerField(default=0, max_length=6, null=True, blank=True)), - ('move', models.ForeignKey(related_name='pokemon', blank=True, to='pokemon_v1.Move', null=True)), + ('move', models.ForeignKey(related_name='pokemon', blank=True, to='pokemon.Move', null=True)), ], options={ 'abstract': False, @@ -154,9 +154,9 @@ class Migration(migrations.Migration): ('speed', models.IntegerField(max_length=4)), ('total', models.IntegerField(max_length=6)), ('egg_cycles', models.IntegerField(max_length=6)), - ('abilities', models.ManyToManyField(to='pokemon_v1.Ability', null=True, blank=True)), - ('descriptions', models.ManyToManyField(to='pokemon_v1.Description', null=True, blank=True)), - ('egg_group', models.ManyToManyField(to='pokemon_v1.EggGroup', null=True, blank=True)), + ('abilities', models.ManyToManyField(to='pokemon.Ability', null=True, blank=True)), + ('descriptions', models.ManyToManyField(to='pokemon.Description', null=True, blank=True)), + ('egg_group', models.ManyToManyField(to='pokemon.EggGroup', null=True, blank=True)), ], options={ 'abstract': False, @@ -170,7 +170,7 @@ class Migration(migrations.Migration): ('modified', models.DateTimeField(auto_now=True)), ('created', models.DateTimeField(auto_now_add=True)), ('name', models.CharField(max_length=50)), - ('image', imagekit.models.fields.ProcessedImageField(upload_to=pokemon_v1.utils.unique_filename)), + ('image', imagekit.models.fields.ProcessedImageField(upload_to=pokemon.utils.unique_filename)), ], options={ 'abstract': False, @@ -197,8 +197,8 @@ class Migration(migrations.Migration): ('modified', models.DateTimeField(auto_now=True)), ('created', models.DateTimeField(auto_now_add=True)), ('ttype', models.CharField(blank=True, max_length=15, null=True, choices=[(b'weak', b'weak'), (b'super effective', b'super effective'), (b'resistant', b'resistant'), (b'ineffective', b'ineffective'), (b'noeffect', b'noeffect'), (b'resist', b'resist')])), - ('frm', models.ForeignKey(related_name='type_frm', blank=True, to='pokemon_v1.Type', null=True)), - ('to', models.ForeignKey(related_name='type_to', blank=True, to='pokemon_v1.Type', null=True)), + ('frm', models.ForeignKey(related_name='type_frm', blank=True, to='pokemon.Type', null=True)), + ('to', models.ForeignKey(related_name='type_to', blank=True, to='pokemon.Type', null=True)), ], options={ 'abstract': False, @@ -208,43 +208,43 @@ class Migration(migrations.Migration): migrations.AddField( model_name='pokemon', name='sprites', - field=models.ManyToManyField(to='pokemon_v1.Sprite', null=True, blank=True), + field=models.ManyToManyField(to='pokemon.Sprite', null=True, blank=True), preserve_default=True, ), migrations.AddField( model_name='pokemon', name='types', - field=models.ManyToManyField(to='pokemon_v1.Type', null=True, blank=True), + field=models.ManyToManyField(to='pokemon.Type', null=True, blank=True), preserve_default=True, ), migrations.AddField( model_name='movepokemon', name='pokemon', - field=models.ForeignKey(related_name='move', blank=True, to='pokemon_v1.Pokemon', null=True), + field=models.ForeignKey(related_name='move', blank=True, to='pokemon.Pokemon', null=True), preserve_default=True, ), migrations.AddField( model_name='move', name='etype', - field=models.ManyToManyField(to='pokemon_v1.Type', null=True), + field=models.ManyToManyField(to='pokemon.Type', null=True), preserve_default=True, ), migrations.AddField( model_name='evolution', name='frm', - field=models.ForeignKey(related_name='frm_evol_pokemon', blank=True, to='pokemon_v1.Pokemon', null=True), + field=models.ForeignKey(related_name='frm_evol_pokemon', blank=True, to='pokemon.Pokemon', null=True), preserve_default=True, ), migrations.AddField( model_name='evolution', name='to', - field=models.ForeignKey(related_name='to_evol_pokemon', blank=True, to='pokemon_v1.Pokemon', null=True), + field=models.ForeignKey(related_name='to_evol_pokemon', blank=True, to='pokemon.Pokemon', null=True), preserve_default=True, ), migrations.AddField( model_name='description', name='game', - field=models.ManyToManyField(to='pokemon_v1.Game', null=True, blank=True), + field=models.ManyToManyField(to='pokemon.Game', null=True, blank=True), preserve_default=True, ), ] diff --git a/pokemon_v2/tests.py b/pokemon_v2/tests.py index b0aa5dd8..5f97b7e7 100644 --- a/pokemon_v2/tests.py +++ b/pokemon_v2/tests.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from django.test import TestCase -# Create your tests here. class HeaderTest(TestCase): @@ -11,6 +10,6 @@ class HeaderTest(TestCase): '/api/v2/pokemon/1/', HTTP_ORIGIN="http://pokemon.com" ) - + self.assertEqual(response['Access-Control-Allow-Origin'], '*') diff --git a/requirements.txt b/requirements.txt index 0d18d65a..157c8362 100755 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ South==1.0 Unipath==1.0 coverage==3.6 django-appconf==0.6 +django-cors-headers==1.0.0 django-discover-runner==0.4 django-imagekit==3.2.4 django-tastypie==0.12.1 @@ -17,4 +18,3 @@ python-mimeparse==0.1.4 simplejson==3.6.5 six==1.8.0 wsgiref==0.1.2 -django-cors-headers=0.13