Skip to content

Commit 8747429

Browse files
authored
Merge pull request #115 from kylemarienthal/master
basic querying the sports orm
2 parents 2c92e6e + 0a1978f commit 8747429

28 files changed

+751
-0
lines changed

Kyle_Marienthal/Django/sports_orm.zip

191 KB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.pyc
2+
__pycache__
3+
.DS_Store
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
###Clone this repo for the CodingDojo Sports ORM assignments in the Django Level 2 curriculum.
2+
3+
`git clone https://github.com/madjaqk/sports_orm.git`
4+
5+
When you `python manage.py runserver` and naviate to localhost:8000, you should see a list of leagues, teams, and players. Modify `apps/leagues/views.py` and/or `apps/leagues/templates/leagues/index.html` to change the displayed list.
6+
7+
####Questions:
8+
9+
[Simple finds](level_1.md)
10+
11+
[ForeignKey relationships](level_2.md)
12+
13+
[ManyToMany relationships](level_3.md)

Kyle_Marienthal/Django/sports_orm/apps/__init__.py

Whitespace-only changes.

Kyle_Marienthal/Django/sports_orm/apps/leagues/__init__.py

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class LeaguesConfig(AppConfig):
5+
name = 'leagues'

Kyle_Marienthal/Django/sports_orm/apps/leagues/fixtures/data.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.10.2 on 2016-10-31 22:53
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
import django.db.models.deletion
7+
8+
9+
class Migration(migrations.Migration):
10+
11+
initial = True
12+
13+
dependencies = [
14+
]
15+
16+
operations = [
17+
migrations.CreateModel(
18+
name='League',
19+
fields=[
20+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21+
('name', models.CharField(max_length=50)),
22+
('sport', models.CharField(max_length=15)),
23+
('created_at', models.DateTimeField(auto_now_add=True)),
24+
('updated_at', models.DateTimeField(auto_now=True)),
25+
],
26+
),
27+
migrations.CreateModel(
28+
name='Player',
29+
fields=[
30+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
31+
('first_name', models.CharField(max_length=15)),
32+
('last_name', models.CharField(max_length=15)),
33+
],
34+
),
35+
migrations.CreateModel(
36+
name='Team',
37+
fields=[
38+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
39+
('city', models.CharField(max_length=50)),
40+
('team_name', models.CharField(max_length=50)),
41+
('league', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='teams', to='leagues.League')),
42+
],
43+
),
44+
migrations.AddField(
45+
model_name='player',
46+
name='curr_team',
47+
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='curr_players', to='leagues.Team'),
48+
),
49+
migrations.AddField(
50+
model_name='player',
51+
name='past_teams',
52+
field=models.ManyToManyField(related_name='all_players', to='leagues.Team'),
53+
),
54+
]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.10.2 on 2016-10-31 23:20
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('leagues', '0001_initial'),
12+
]
13+
14+
operations = [
15+
migrations.RenameField(
16+
model_name='team',
17+
old_name='city',
18+
new_name='location',
19+
),
20+
]

0 commit comments

Comments
 (0)