Autoformat entire project, tidy up makefile

This commit is contained in:
Paul Hallett 2020-02-18 09:58:07 +13:00 committed by Paul Hallett
parent c7e10bd044
commit d5d55dad7f
17 changed files with 9667 additions and 4956 deletions

View file

@ -8,10 +8,10 @@ jobs:
- checkout - checkout
- run: - run:
name: Install deps name: Install deps
command: sudo make install && sudo make dev-install command: sudo make dev-install
- run: - run:
name: Linting name: Linting
command: make lint command: make format-check
- run: - run:
name: Run tests name: Run tests
command: make test command: make test

View file

@ -1,29 +1,38 @@
install: .PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?# .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?# "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
install: # Install base requirements to run project
pip install -r requirements.txt pip install -r requirements.txt
dev-install: dev-install: # Install developer requirements + base requirements
pip install -r test-requirements.txt pip install -r test-requirements.txt
lint: setup: # Set up the project database
pylint config data pokemon_v2 --load-plugins pylint_django
setup:
python manage.py migrate --settings=config.local python manage.py migrate --settings=config.local
wipe_db: wipe_db: # Delete's the project database
rm -rf db.sqlite3 rm -rf db.sqlite3
serve: serve: # Run the project locally
python manage.py runserver --settings=config.local python manage.py runserver --settings=config.local
test: test: # Run tests
python manage.py test --settings=config.local python manage.py test --settings=config.local
clean: clean: # Remove any pyc files
find . -type f -name '*.pyc' -delete find . -type f -name '*.pyc' -delete
migrate: migrate: # run any outstanding migrations
python manage.py migrate --settings=config.local python manage.py migrate --settings=config.local
shell: shell: # Load a shell
python manage.py shell --settings=config.local python manage.py shell --settings=config.local
format: # Format the source code
black .
format-check: # Check the source code has been formatted
black . --check

View file

@ -2,13 +2,13 @@
from .settings import * from .settings import *
DATABASES = { DATABASES = {
'default': { "default": {
'ENGINE': 'django.db.backends.postgresql_psycopg2', "ENGINE": "django.db.backends.postgresql_psycopg2",
'NAME': 'pokeapi', "NAME": "pokeapi",
'USER': 'ash', "USER": "ash",
'PASSWORD': 'pokemon', "PASSWORD": "pokemon",
'HOST': 'db', "HOST": "db",
'PORT': 5432, "PORT": 5432,
} }
} }
@ -17,9 +17,7 @@ CACHES = {
"default": { "default": {
"BACKEND": "django_redis.cache.RedisCache", "BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://cache:6379/1", "LOCATION": "redis://cache:6379/1",
"OPTIONS": { "OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient",},
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
} }
} }

View file

@ -2,13 +2,13 @@
from .settings import * from .settings import *
DATABASES = { DATABASES = {
'default': { "default": {
'ENGINE': 'django.db.backends.postgresql_psycopg2', "ENGINE": "django.db.backends.postgresql_psycopg2",
'NAME': 'pokeapi', "NAME": "pokeapi",
'USER': 'ash', "USER": "ash",
'PASSWORD': 'pokemon', "PASSWORD": "pokemon",
'HOST': 'localhost', "HOST": "localhost",
'PORT': '', "PORT": "",
} }
} }
@ -17,9 +17,7 @@ CACHES = {
"default": { "default": {
"BACKEND": "django_redis.cache.RedisCache", "BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1", "LOCATION": "redis://127.0.0.1:6379/1",
"OPTIONS": { "OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient",},
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
} }
} }

View file

@ -1,17 +1,13 @@
from .settings import * from .settings import *
DATABASES = { DATABASES = {
'default': { "default": {
'ENGINE': 'django.db.backends.sqlite3', "ENGINE": "django.db.backends.sqlite3",
'NAME': os.path.join(PROJECT_ROOT, 'db.sqlite3'), "NAME": os.path.join(PROJECT_ROOT, "db.sqlite3"),
} }
} }
CACHES = { CACHES = {"default": {"BACKEND": "django.core.cache.backends.dummy.DummyCache",}}
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
DEBUG = True DEBUG = True
TASTYPIE_FULL_DEBUG = True TASTYPIE_FULL_DEBUG = True

View file

@ -8,23 +8,21 @@ DEBUG = False
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
ADMINS = ( ADMINS = (("Paul Hallett", "paulandrewhallett@gmail.com"),)
('Paul Hallett', 'paulandrewhallett@gmail.com'),
)
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
MANAGERS = ADMINS MANAGERS = ADMINS
BASE_URL = 'http://pokeapi.co' BASE_URL = "http://pokeapi.co"
# Hosts/domain names that are valid for this site; required if DEBUG is False # 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 # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['.pokeapi.co', 'localhost', '127.0.0.1'] ALLOWED_HOSTS = [".pokeapi.co", "localhost", "127.0.0.1"]
TIME_ZONE = 'Europe/London' TIME_ZONE = "Europe/London"
LANGUAGE_CODE = 'en-gb' LANGUAGE_CODE = "en-gb"
SITE_ID = 1 SITE_ID = 1
@ -40,33 +38,33 @@ USE_L10N = True
USE_TZ = True USE_TZ = True
# Explicitly define test runner to avoid warning messages on test execution # Explicitly define test runner to avoid warning messages on test execution
TEST_RUNNER = 'django.test.runner.DiscoverRunner' TEST_RUNNER = "django.test.runner.DiscoverRunner"
SECRET_KEY = '4nksdock439320df*(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#' SECRET_KEY = "4nksdock439320df*(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#"
MIDDLEWARE = [ MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware', "corsheaders.middleware.CorsMiddleware",
'django.middleware.common.CommonMiddleware', "django.middleware.common.CommonMiddleware",
'django.contrib.sessions.middleware.SessionMiddleware', "django.contrib.sessions.middleware.SessionMiddleware",
'django.middleware.csrf.CsrfViewMiddleware', "django.middleware.csrf.CsrfViewMiddleware",
'django.contrib.auth.middleware.AuthenticationMiddleware', "django.contrib.auth.middleware.AuthenticationMiddleware",
'django.contrib.messages.middleware.MessageMiddleware', "django.contrib.messages.middleware.MessageMiddleware",
'django.middleware.clickjacking.XFrameOptionsMiddleware', "django.middleware.clickjacking.XFrameOptionsMiddleware",
] ]
ROOT_URLCONF = 'config.urls' ROOT_URLCONF = "config.urls"
WSGI_APPLICATION = 'config.wsgi.application' WSGI_APPLICATION = "config.wsgi.application"
DATABASES = { DATABASES = {
'default': { "default": {
'ENGINE': 'django.db.backends.postgresql_psycopg2', "ENGINE": "django.db.backends.postgresql_psycopg2",
'NAME': 'pokeapi_co_db', "NAME": "pokeapi_co_db",
'USER': 'root', "USER": "root",
'PASSWORD': 'pokeapi', "PASSWORD": "pokeapi",
'HOST': 'localhost', "HOST": "localhost",
'PORT': '', "PORT": "",
'CONN_MAX_AGE': 30 "CONN_MAX_AGE": 30,
} }
} }
@ -74,57 +72,46 @@ CACHES = {
"default": { "default": {
"BACKEND": "django_redis.cache.RedisCache", "BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1", "LOCATION": "redis://127.0.0.1:6379/1",
"OPTIONS": { "OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient",},
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
} }
} }
SECRET_KEY = os.environ.get( SECRET_KEY = os.environ.get(
'SECRET_KEY', "SECRET_KEY", "ubx+22!jbo(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#"
'ubx+22!jbo(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#') )
CUSTOM_APPS = ( CUSTOM_APPS = (
'tastypie', "tastypie",
'pokemon_v2', "pokemon_v2",
) )
INSTALLED_APPS = ( INSTALLED_APPS = (
'django.contrib.auth', "django.contrib.auth",
'django.contrib.contenttypes', "django.contrib.contenttypes",
'django.contrib.sessions', "django.contrib.sessions",
'django.contrib.sites', "django.contrib.sites",
'django.contrib.admin', "django.contrib.admin",
'django.contrib.humanize', "django.contrib.humanize",
'corsheaders', "corsheaders",
'rest_framework', "rest_framework",
'cachalot' "cachalot",
) + CUSTOM_APPS ) + CUSTOM_APPS
API_LIMIT_PER_PAGE = 1 API_LIMIT_PER_PAGE = 1
TASTYPIE_DEFAULT_FORMATS = ['json'] TASTYPIE_DEFAULT_FORMATS = ["json"]
CORS_ORIGIN_ALLOW_ALL = True CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_METHODS = ( CORS_ALLOW_METHODS = "GET"
'GET'
)
CORS_URLS_REGEX = r'^/api/.*$' CORS_URLS_REGEX = r"^/api/.*$"
REST_FRAMEWORK = { REST_FRAMEWORK = {
'DEFAULT_RENDERER_CLASSES': ( "DEFAULT_RENDERER_CLASSES": ("drf_ujson.renderers.UJSONRenderer",),
'drf_ujson.renderers.UJSONRenderer', "DEFAULT_PARSER_CLASSES": ("drf_ujson.renderers.UJSONRenderer",),
), "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
'DEFAULT_PARSER_CLASSES': ( "PAGE_SIZE": 20,
'drf_ujson.renderers.UJSONRenderer', "PAGINATE_BY": 20,
),
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 20,
'PAGINATE_BY': 20
} }

View file

@ -4,5 +4,5 @@ from pokemon_v2 import urls as pokemon_v2_urls
# pylint: disable=invalid-name # pylint: disable=invalid-name
urlpatterns = [ urlpatterns = [
url(r'^', include(pokemon_v2_urls)), url(r"^", include(pokemon_v2_urls)),
] ]

View file

@ -14,7 +14,8 @@ from .serializers import *
# BEHAVIOR ABSTRACTIONS # # BEHAVIOR ABSTRACTIONS #
########################### ###########################
class ListOrDetailSerialRelation():
class ListOrDetailSerialRelation:
""" """
Mixin to allow association with separate serializers Mixin to allow association with separate serializers
for list or detail view. for list or detail view.
@ -23,12 +24,12 @@ class ListOrDetailSerialRelation():
list_serializer_class = None list_serializer_class = None
def get_serializer_class(self): def get_serializer_class(self):
if (self.action == 'list' and self.list_serializer_class is not None): if self.action == "list" and self.list_serializer_class is not None:
return self.list_serializer_class return self.list_serializer_class
return self.serializer_class return self.serializer_class
class NameOrIdRetrieval(): class NameOrIdRetrieval:
""" """
Mixin to allow retrieval of resources by Mixin to allow retrieval of resources by
pk (in this case ID) or by name pk (in this case ID) or by name
@ -40,7 +41,7 @@ class NameOrIdRetrieval():
def get_object(self): def get_object(self):
queryset = self.get_queryset() queryset = self.get_queryset()
queryset = self.filter_queryset(queryset) queryset = self.filter_queryset(queryset)
lookup = self.kwargs['pk'] lookup = self.kwargs["pk"]
if self.idPattern.match(lookup): if self.idPattern.match(lookup):
resp = get_object_or_404(queryset, pk=lookup) resp = get_object_or_404(queryset, pk=lookup)
@ -54,8 +55,9 @@ class NameOrIdRetrieval():
return resp return resp
class PokeapiCommonViewset(ListOrDetailSerialRelation, class PokeapiCommonViewset(
NameOrIdRetrieval, viewsets.ReadOnlyModelViewSet): ListOrDetailSerialRelation, NameOrIdRetrieval, viewsets.ReadOnlyModelViewSet
):
pass pass
@ -63,6 +65,7 @@ class PokeapiCommonViewset(ListOrDetailSerialRelation,
# APIS # # APIS #
########## ##########
class AbilityResource(PokeapiCommonViewset): class AbilityResource(PokeapiCommonViewset):
queryset = Ability.objects.all() queryset = Ability.objects.all()
@ -352,7 +355,7 @@ class PokemonResource(PokeapiCommonViewset):
class PokemonSpeciesResource(PokeapiCommonViewset): class PokemonSpeciesResource(PokeapiCommonViewset):
queryset = PokemonSpecies.objects.all().order_by('id') queryset = PokemonSpecies.objects.all().order_by("id")
serializer_class = PokemonSpeciesDetailSerializer serializer_class = PokemonSpeciesDetailSerializer
list_serializer_class = PokemonSpeciesSummarySerializer list_serializer_class = PokemonSpeciesSummarySerializer
@ -415,10 +418,11 @@ class PokemonEncounterView(APIView):
encounter_objects = Encounter.objects.filter(pokemon=pokemon) encounter_objects = Encounter.objects.filter(pokemon=pokemon)
area_ids = (encounter_objects area_ids = (
.order_by('location_area') encounter_objects.order_by("location_area")
.distinct('location_area') .distinct("location_area")
.values_list('location_area', flat=True)) .values_list("location_area", flat=True)
)
location_area_objects = LocationArea.objects.filter(pk__in=area_ids) location_area_objects = LocationArea.objects.filter(pk__in=area_ids)
version_objects = Version.objects version_objects = Version.objects
@ -431,10 +435,11 @@ class PokemonEncounterView(APIView):
area_encounters = encounter_objects.filter(location_area_id=area_id) area_encounters = encounter_objects.filter(location_area_id=area_id)
version_ids = (area_encounters version_ids = (
.order_by('version_id') area_encounters.order_by("version_id")
.distinct('version_id') .distinct("version_id")
.values_list('version_id', flat=True)) .values_list("version_id", flat=True)
)
version_details_list = [] version_details_list = []
@ -442,40 +447,48 @@ class PokemonEncounterView(APIView):
version = version_objects.get(pk=version_id) version = version_objects.get(pk=version_id)
version_encounters = (area_encounters version_encounters = area_encounters.filter(
.filter(version_id=version_id) version_id=version_id
.order_by('encounter_slot_id')) ).order_by("encounter_slot_id")
encounters_data = EncounterDetailSerializer( encounters_data = EncounterDetailSerializer(
version_encounters, many=True, context=self.context).data version_encounters, many=True, context=self.context
).data
max_chance = 0 max_chance = 0
encounter_details_list = [] encounter_details_list = []
for encounter in encounters_data: for encounter in encounters_data:
slot = EncounterSlot.objects.get(pk=encounter['encounter_slot']) slot = EncounterSlot.objects.get(pk=encounter["encounter_slot"])
slot_data = EncounterSlotSerializer(slot, context=self.context).data slot_data = EncounterSlotSerializer(slot, context=self.context).data
del encounter['pokemon'] del encounter["pokemon"]
del encounter['encounter_slot'] del encounter["encounter_slot"]
del encounter['location_area'] del encounter["location_area"]
del encounter['version'] del encounter["version"]
encounter['chance'] = slot_data['chance'] encounter["chance"] = slot_data["chance"]
max_chance += slot_data['chance'] max_chance += slot_data["chance"]
encounter['method'] = slot_data['encounter_method'] encounter["method"] = slot_data["encounter_method"]
encounter_details_list.append(encounter) encounter_details_list.append(encounter)
version_details_list.append({ version_details_list.append(
'version': VersionSummarySerializer(version, context=self.context).data, {
'max_chance': max_chance, "version": VersionSummarySerializer(
'encounter_details': encounter_details_list version, context=self.context
}) ).data,
"max_chance": max_chance,
"encounter_details": encounter_details_list,
}
)
encounters_list.append({ encounters_list.append(
'location_area': LocationAreaSummarySerializer( {
location_area, context=self.context).data, "location_area": LocationAreaSummarySerializer(
'version_details': version_details_list location_area, context=self.context
}) ).data,
"version_details": version_details_list,
}
)
return Response(encounters_list) return Response(encounters_list)

File diff suppressed because it is too large Load diff

View file

@ -4,41 +4,86 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('pokemon_v2', '0001_squashed_0002_auto_20160301_1408'), ("pokemon_v2", "0001_squashed_0002_auto_20160301_1408"),
] ]
operations = [ operations = [
migrations.CreateModel( migrations.CreateModel(
name='ItemSprites', name="ItemSprites",
fields=[ fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), (
('sprites', models.CharField(max_length=500)), "id",
('item', models.ForeignKey(on_delete=models.CASCADE, related_name='itemsprites', blank=True, to='pokemon_v2.Item', null=True)), models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
("sprites", models.CharField(max_length=500)),
(
"item",
models.ForeignKey(
on_delete=models.CASCADE,
related_name="itemsprites",
blank=True,
to="pokemon_v2.Item",
null=True,
),
),
], ],
options={ options={"abstract": False,},
'abstract': False,
},
), ),
migrations.CreateModel( migrations.CreateModel(
name='PokemonFormSprites', name="PokemonFormSprites",
fields=[ fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), (
('sprites', models.CharField(max_length=500)), "id",
('pokemon_form', models.ForeignKey(on_delete=models.CASCADE, related_name='pokemonformsprites', blank=True, to='pokemon_v2.PokemonForm', null=True)), models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
("sprites", models.CharField(max_length=500)),
(
"pokemon_form",
models.ForeignKey(
on_delete=models.CASCADE,
related_name="pokemonformsprites",
blank=True,
to="pokemon_v2.PokemonForm",
null=True,
),
),
], ],
options={ options={"abstract": False,},
'abstract': False,
},
), ),
migrations.CreateModel( migrations.CreateModel(
name='PokemonSprites', name="PokemonSprites",
fields=[ fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), (
('sprites', models.CharField(max_length=500)), "id",
('pokemon', models.ForeignKey(on_delete=models.CASCADE, related_name='pokemonsprites', blank=True, to='pokemon_v2.Pokemon', null=True)), models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
("sprites", models.CharField(max_length=500)),
(
"pokemon",
models.ForeignKey(
on_delete=models.CASCADE,
related_name="pokemonsprites",
blank=True,
to="pokemon_v2.Pokemon",
null=True,
),
),
], ],
options={ options={"abstract": False,},
'abstract': False,
},
), ),
] ]

View file

@ -4,493 +4,493 @@ from django.db import models, migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('pokemon_v2', '0002_itemsprites_pokemonformsprites_pokemonsprites'), ("pokemon_v2", "0002_itemsprites_pokemonformsprites_pokemonsprites"),
] ]
operations = [ operations = [
migrations.AlterField( migrations.AlterField(
model_name='ability', model_name="ability",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='abilityname', model_name="abilityname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='berry', model_name="berry",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='berryfirmness', model_name="berryfirmness",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='berryfirmnessname', model_name="berryfirmnessname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='berryflavor', model_name="berryflavor",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='berryflavorname', model_name="berryflavorname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='contesttype', model_name="contesttype",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='contesttypename', model_name="contesttypename",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='egggroup', model_name="egggroup",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='egggroupname', model_name="egggroupname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='encountercondition', model_name="encountercondition",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='encounterconditionname', model_name="encounterconditionname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='encounterconditionvalue', model_name="encounterconditionvalue",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='encounterconditionvaluename', model_name="encounterconditionvaluename",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='encountermethod', model_name="encountermethod",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='encountermethodname', model_name="encountermethodname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='evolutiontrigger', model_name="evolutiontrigger",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='evolutiontriggername', model_name="evolutiontriggername",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='gender', model_name="gender",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='generation', model_name="generation",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='generationname', model_name="generationname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='growthrate', model_name="growthrate",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='item', model_name="item",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='itemattribute', model_name="itemattribute",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='itemattributename', model_name="itemattributename",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='itemcategory', model_name="itemcategory",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='itemcategoryname', model_name="itemcategoryname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='itemflingeffect', model_name="itemflingeffect",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='itemname', model_name="itemname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='itempocket', model_name="itempocket",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='itempocketname', model_name="itempocketname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='language', model_name="language",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='languagename', model_name="languagename",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='location', model_name="location",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='locationarea', model_name="locationarea",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='locationareaname', model_name="locationareaname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='locationname', model_name="locationname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='move', model_name="move",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='moveattribute', model_name="moveattribute",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='moveattributename', model_name="moveattributename",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='movebattlestyle', model_name="movebattlestyle",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='movebattlestylename', model_name="movebattlestylename",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='movedamageclass', model_name="movedamageclass",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='movedamageclassname', model_name="movedamageclassname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='movelearnmethod', model_name="movelearnmethod",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='movelearnmethodname', model_name="movelearnmethodname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='movemetaailment', model_name="movemetaailment",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='movemetaailmentname', model_name="movemetaailmentname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='movemetacategory', model_name="movemetacategory",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='movename', model_name="movename",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='movetarget', model_name="movetarget",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='movetargetname', model_name="movetargetname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='nature', model_name="nature",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='naturename', model_name="naturename",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='palparkarea', model_name="palparkarea",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='palparkareaname', model_name="palparkareaname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokeathlonstat', model_name="pokeathlonstat",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokeathlonstatname', model_name="pokeathlonstatname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokedex', model_name="pokedex",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokedexname', model_name="pokedexname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokemon', model_name="pokemon",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokemoncolor', model_name="pokemoncolor",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokemoncolorname', model_name="pokemoncolorname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokemonform', model_name="pokemonform",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokemonformname', model_name="pokemonformname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokemonhabitat', model_name="pokemonhabitat",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokemonhabitatname', model_name="pokemonhabitatname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokemonshape', model_name="pokemonshape",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokemonshapename', model_name="pokemonshapename",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokemonspecies', model_name="pokemonspecies",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='pokemonspeciesname', model_name="pokemonspeciesname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='region', model_name="region",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='regionname', model_name="regionname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='stat', model_name="stat",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='statname', model_name="statname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='type', model_name="type",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='typename', model_name="typename",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='version', model_name="version",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='versiongroup', model_name="versiongroup",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='versionname', model_name="versionname",
name='name', name="name",
field=models.CharField(max_length=100, db_index=True), field=models.CharField(max_length=100, db_index=True),
preserve_default=True, preserve_default=True,
), ),

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,13 +3,8 @@ from pokemon_v2.models import *
class AbilityTestCase(TestCase): class AbilityTestCase(TestCase):
def setUp(self): def setUp(self):
Ability.objects.create( Ability.objects.create(name="Smell", generation_id=3, is_main_series=True)
name="Smell",
generation_id=3,
is_main_series=True
)
def fields_are_valid(self): def fields_are_valid(self):
smell = Ability.objects.get(name="Smell") smell = Ability.objects.get(name="Smell")

File diff suppressed because it is too large Load diff

View file

@ -70,7 +70,10 @@ router.register(r"version-group", VersionGroupResource)
########################### ###########################
urlpatterns = [ urlpatterns = [
url(r'^api/v2/', include(router.urls)), url(r"^api/v2/", include(router.urls)),
url(r'^api/v2/pokemon/(?P<pokemon_id>\d+)/encounters', url(
PokemonEncounterView.as_view(), name='pokemon_encounters') r"^api/v2/pokemon/(?P<pokemon_id>\d+)/encounters",
PokemonEncounterView.as_view(),
name="pokemon_encounters",
),
] ]

View file

@ -1,3 +1,5 @@
-r requirements.txt
pylint===2.1.1 pylint===2.1.1
pylint-django===2.0.2 pylint-django===2.0.2
astroid==2.0.4 astroid==2.0.4
black==19.10b0