From 3f25eba46cb895eb4aa9bbcea1a63c156be86345 Mon Sep 17 00:00:00 2001 From: Skyler Burger Date: Thu, 15 Aug 2019 15:21:10 -0700 Subject: [PATCH 1/2] add ThreeGs --- .vscode/settings.json | 2 +- snakes_on_plane_project/settings.py | 1 + three_gs/__init__.py | 0 three_gs/admin.py | 5 +++++ three_gs/apps.py | 5 +++++ three_gs/migrations/0001_initial.py | 29 +++++++++++++++++++++++++++++ three_gs/migrations/__init__.py | 0 three_gs/models.py | 10 ++++++++++ three_gs/tests.py | 3 +++ three_gs/views.py | 3 +++ 10 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 three_gs/__init__.py create mode 100644 three_gs/admin.py create mode 100644 three_gs/apps.py create mode 100644 three_gs/migrations/0001_initial.py create mode 100644 three_gs/migrations/__init__.py create mode 100644 three_gs/models.py create mode 100644 three_gs/tests.py create mode 100644 three_gs/views.py diff --git a/.vscode/settings.json b/.vscode/settings.json index 5d94cac..96cf67e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "python.pythonPath": "/Users/jb/.local/share/virtualenvs/api-cP68AE47/bin/python" + "python.pythonPath": "/home/skybur/.local/share/virtualenvs/api-pUB2aoZM/bin/python" } \ No newline at end of file diff --git a/snakes_on_plane_project/settings.py b/snakes_on_plane_project/settings.py index 995cbec..21c75fb 100644 --- a/snakes_on_plane_project/settings.py +++ b/snakes_on_plane_project/settings.py @@ -38,6 +38,7 @@ 'django.contrib.messages', 'django.contrib.staticfiles', 'passengers.apps.PassengersConfig', + 'three_gs.apps.ThreeGsConfig', ] MIDDLEWARE = [ diff --git a/three_gs/__init__.py b/three_gs/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/three_gs/admin.py b/three_gs/admin.py new file mode 100644 index 0000000..94cd59c --- /dev/null +++ b/three_gs/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin +from .models import ThreeGs + +# Register your models here. +admin.site.register(ThreeGs) diff --git a/three_gs/apps.py b/three_gs/apps.py new file mode 100644 index 0000000..d64f57a --- /dev/null +++ b/three_gs/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ThreeGsConfig(AppConfig): + name = 'three_gs' diff --git a/three_gs/migrations/0001_initial.py b/three_gs/migrations/0001_initial.py new file mode 100644 index 0000000..6b6a8f4 --- /dev/null +++ b/three_gs/migrations/0001_initial.py @@ -0,0 +1,29 @@ +# Generated by Django 2.2.4 on 2019-08-15 22:14 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('passengers', '0007_delete_passenger'), + ] + + operations = [ + migrations.CreateModel( + name='ThreeGs', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=256)), + ('accessories', models.CharField(max_length=256)), + ('carry_on', models.ForeignKey(default=None, on_delete=django.db.models.deletion.SET_DEFAULT, related_name='carry_on', to='passengers.CarryOn')), + ('personal_item', models.ForeignKey(default=None, on_delete=django.db.models.deletion.SET_DEFAULT, related_name='personal_item', to='passengers.CarryOn')), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/three_gs/migrations/__init__.py b/three_gs/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/three_gs/models.py b/three_gs/models.py new file mode 100644 index 0000000..d929282 --- /dev/null +++ b/three_gs/models.py @@ -0,0 +1,10 @@ +from django.db import models +from passengers.models import Passenger + +# Create your models here. +class ThreeGs(Passenger): + accessories = models.CharField(max_length=256) + + def sanitizer_spray(snake): + snake.health -= 10 + print("Ew gross!") diff --git a/three_gs/tests.py b/three_gs/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/three_gs/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/three_gs/views.py b/three_gs/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/three_gs/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. From ff4887c509cb3adde456fafb5e48770cd5eda751 Mon Sep 17 00:00:00 2001 From: Marvin Colgin Date: Thu, 15 Aug 2019 15:57:52 -0700 Subject: [PATCH 2/2] THREEG: model, tests complete. --- three_gs/models.py | 5 ++--- three_gs/tests.py | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/three_gs/models.py b/three_gs/models.py index d929282..84edd82 100644 --- a/three_gs/models.py +++ b/three_gs/models.py @@ -5,6 +5,5 @@ class ThreeGs(Passenger): accessories = models.CharField(max_length=256) - def sanitizer_spray(snake): - snake.health -= 10 - print("Ew gross!") + def descAccessories(self): + return f'I have: {self.accessories}' diff --git a/three_gs/tests.py b/three_gs/tests.py index 7ce503c..50433b4 100644 --- a/three_gs/tests.py +++ b/three_gs/tests.py @@ -1,3 +1,21 @@ from django.test import TestCase +from passengers.models import CarryOn +from .models import ThreeGs -# Create your tests here. +class Three3GsTestCase(TestCase): + def setUp(self): + rake = CarryOn.objects.create(name="rake") + cell = CarryOn.objects.create(name="cell") + three3 = ThreeGs.objects.create( + name = 'OG', + carry_on = rake, + personal_item = cell, + accessories = 'Gold Chain') + + def test_accessories(self): + three3 = ThreeGs.objects.get(name = 'OG') + self.assertEquals(three3.accessories, 'Gold Chain') + + def test_descAccessories(self): + three3 = ThreeGs.objects.get(name = 'OG') + self.assertEquals(three3.descAccessories(), 'I have: Gold Chain')