Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Austen django 03 #346

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Code/Austen/django-03/.github/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Description

## Project Tasks

- load 'pokemon.json' file into project db
- create models within an app
- write a [custom management command](../docs/01%20Django%20Overview.md#custom-management-commands) to request data from pokeapi and save it in the db
- list loaded pokemon in pages
- write a view, url, and template
- display pokemon based on user search queries

## Changelog
- 3/14/22-1
- generated requirements.txt
- added load all option
- added update_data method to Species model
- 3/14/22-2
- created custom management command
22 changes: 22 additions & 0 deletions Code/Austen/django-03/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#2f7c47",
"activityBar.activeBorder": "#422c74",
"activityBar.background": "#2f7c47",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#422c74",
"activityBarBadge.foreground": "#e7e7e7",
"sash.hoverBorder": "#2f7c47",
"statusBar.background": "#215732",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#2f7c47",
"statusBarItem.remoteBackground": "#215732",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#215732",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#21573299",
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#215732"
}
Empty file.
6 changes: 6 additions & 0 deletions Code/Austen/django-03/POKEDEX/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(Species)
admin.site.register(Typing)
admin.site.register(Ability)
6 changes: 6 additions & 0 deletions Code/Austen/django-03/POKEDEX/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class PokedexConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'POKEDEX'
25 changes: 25 additions & 0 deletions Code/Austen/django-03/POKEDEX/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.0.3 on 2022-03-07 06:44

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Species',
fields=[
('dexid', models.IntegerField(primary_key=True, serialize=False)),
('url', models.URLField()),
('name', models.CharField(max_length=25)),
],
options={
'verbose_name_plural': 'Species',
},
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 4.0.3 on 2022-03-07 07:15

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('POKEDEX', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='Typing',
fields=[
('typeid', models.IntegerField(primary_key=True, serialize=False)),
('url', models.URLField()),
('name', models.CharField(max_length=25)),
],
),
migrations.AddField(
model_name='species',
name='type1',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='type1', to='POKEDEX.typing'),
),
migrations.AddField(
model_name='species',
name='type2',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='type2', to='POKEDEX.typing'),
),
]
19 changes: 19 additions & 0 deletions Code/Austen/django-03/POKEDEX/migrations/0003_species_sprite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.0.3 on 2022-03-07 08:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('POKEDEX', '0002_typing_species_type1_species_type2'),
]

operations = [
migrations.AddField(
model_name='species',
name='sprite',
field=models.URLField(default='x.com'),
preserve_default=False,
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by Django 4.0.3 on 2022-03-07 08:30

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('POKEDEX', '0003_species_sprite'),
]

operations = [
migrations.CreateModel(
name='Ability',
fields=[
('abilityid', models.IntegerField(primary_key=True, serialize=False)),
('url', models.URLField()),
('name', models.CharField(max_length=25)),
],
),
migrations.AddField(
model_name='species',
name='ability1',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ability1', to='POKEDEX.ability'),
),
migrations.AddField(
model_name='species',
name='ability2',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ability2', to='POKEDEX.ability'),
),
migrations.AddField(
model_name='species',
name='hidden_ability',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hidden_ability', to='POKEDEX.ability'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Generated by Django 4.0.3 on 2022-03-07 08:52

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('POKEDEX', '0004_ability_species_ability1_species_ability2_and_more'),
]

operations = [
migrations.AddField(
model_name='species',
name='attack',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='species',
name='defense',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='species',
name='height',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='species',
name='hp',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='species',
name='s_attack',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='species',
name='s_defense',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='species',
name='speed',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='species',
name='weight',
field=models.IntegerField(default=0),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.0.3 on 2022-03-07 08:57

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('POKEDEX', '0005_species_attack_species_defense_species_height_and_more'),
]

operations = [
migrations.AlterField(
model_name='species',
name='height',
field=models.DecimalField(decimal_places=2, default=0, max_digits=5),
),
migrations.AlterField(
model_name='species',
name='weight',
field=models.DecimalField(decimal_places=2, default=0, max_digits=5),
),
]
19 changes: 19 additions & 0 deletions Code/Austen/django-03/POKEDEX/migrations/0007_typing_color.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.0.3 on 2022-03-07 09:23

import colorful.fields
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('POKEDEX', '0006_alter_species_height_alter_species_weight'),
]

operations = [
migrations.AddField(
model_name='typing',
name='color',
field=colorful.fields.RGBColorField(default='#000000'),
),
]
18 changes: 18 additions & 0 deletions Code/Austen/django-03/POKEDEX/migrations/0008_typing_pokemon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.0.3 on 2022-03-07 11:34

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('POKEDEX', '0007_typing_color'),
]

operations = [
migrations.AddField(
model_name='typing',
name='pokemon',
field=models.ManyToManyField(to='POKEDEX.species'),
),
]
18 changes: 18 additions & 0 deletions Code/Austen/django-03/POKEDEX/migrations/0009_ability_pokemon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.0.3 on 2022-03-07 11:34

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('POKEDEX', '0008_typing_pokemon'),
]

operations = [
migrations.AddField(
model_name='ability',
name='pokemon',
field=models.ManyToManyField(to='POKEDEX.species'),
),
]
Empty file.
Loading