mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-25 04:40:21 +00:00
Create DB model and migration for past Pokemon types
This commit is contained in:
parent
eb5b0968eb
commit
1d9e41d100
2 changed files with 33 additions and 0 deletions
27
pokemon_v2/migrations/0004_pokemontypepast.py
Normal file
27
pokemon_v2/migrations/0004_pokemontypepast.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Generated by Django 2.1.2 on 2019-11-30 20:48
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0003_auto_20160530_1132'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='PokemonTypePast',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('slot', models.IntegerField()),
|
||||
('generation', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='pokemontypepast', to='pokemon_v2.Generation')),
|
||||
('pokemon', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='pokemontypepast', to='pokemon_v2.Pokemon')),
|
||||
('type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='pokemontypepast', to='pokemon_v2.Type')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
|
@ -1480,6 +1480,12 @@ class PokemonType(HasPokemon, HasType):
|
|||
slot = models.IntegerField()
|
||||
|
||||
|
||||
# model for a Pokemon's types that were used until a given generation
|
||||
class PokemonTypePast(HasPokemon, HasType, HasGeneration):
|
||||
|
||||
slot = models.IntegerField()
|
||||
|
||||
|
||||
class PokemonSprites(HasPokemon):
|
||||
|
||||
sprites = models.CharField(max_length=500)
|
||||
|
|
Loading…
Reference in a new issue