-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
2,689 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ node_modules | |
.tmp | ||
npm-debug.log | ||
wisdompets/db.sqlite3 | ||
__pycache__/ | ||
*.py[cod] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<html lang="en-US"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Home - Wisdom Pet Medicine</title> | ||
<link rel="stylesheet" id="ample-style-css" href="http://wisdompets.com/wp-content/themes/ample/style.css?ver=4.8.3" type="text/css" media="all"> | ||
</head> | ||
<body class="wide"> | ||
<div id="page" class="hfeed site"> | ||
<header> | ||
<div class="header"> | ||
<div class="main-head-wrap inner-wrap clearfix"> | ||
<div id="header-logo-image"> | ||
<a href="/"> | ||
<img src="http://wisdompets.com/wp-content/uploads/2015/10/wisdom-pet-logo-single.png" alt="Wisdom Pet Medicine"> | ||
</a> | ||
</div> | ||
<div id="header-text" class=""> | ||
<h1 id="site-title"> | ||
<a href="/" title="Wisdom Pet Medicine" rel="home">Wisdom Pet Medicine</a> | ||
</h1> | ||
<p>We treat your pets like we treat our own.</p> | ||
</div> | ||
</div> | ||
<img src="http://wisdompets.com/wp-content/uploads/2015/10/1500x400-header_114150655.jpg" alt="Wisdom Pet Medicine"> | ||
</div> | ||
</header> | ||
<div class="main-wrapper"> | ||
<div class="single-page clearfix"> | ||
<div class="inner-wrap"> | ||
<p>Wisdom Pet Medicine strives to blend the best in traditional and alternative medicine in the diagnosis and treatment of health conditions in companion animals, including dogs, cats, birds, reptiles, rodents, and fish. We apply the latest healthcare technology, along with the wisdom garnered in the centuries old tradition of veterinary medicine, to find the safest and most effective treatments and cures, while maintaining a caring relationship with our patients and their guardians.</p> | ||
<hr> | ||
<div> | ||
<!-- Insert content here--> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<footer id="colophon"> | ||
<div class="inner-wrap"> | ||
Wisdom Pet Medicine is a fictitious brand created by Lynda.com, solely for the purpose of training. All products and people associated with Wisdom Pet Medicine are also fictitious. Any resemblance to real brands, products, or people is purely coincidental. Please see your veterinarian for all matters related to your pet's health. | ||
</div> | ||
</footer> | ||
</div> | ||
</body> | ||
</html> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Pet | ||
|
||
@admin.register(Pet) | ||
class PetAdmin(admin.ModelAdmin): | ||
list_display = ['name', 'species', 'breed', 'age', 'sex'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AdoptionsConfig(AppConfig): | ||
name = 'adoptions' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from csv import DictReader | ||
from datetime import datetime | ||
|
||
from django.core.management import BaseCommand | ||
|
||
from adoptions.models import Pet, Vaccine | ||
from pytz import UTC | ||
|
||
|
||
DATETIME_FORMAT = '%m/%d/%Y %H:%M' | ||
|
||
VACCINES_NAMES = [ | ||
'Canine Parvo', | ||
'Canine Distemper', | ||
'Canine Rabies', | ||
'Canine Leptospira', | ||
'Feline Herpes Virus 1', | ||
'Feline Rabies', | ||
'Feline Leukemia' | ||
] | ||
|
||
ALREDY_LOADED_ERROR_MESSAGE = """ | ||
If you need to reload the pet data from the CSV file, | ||
first delete the db.sqlite3 file to destroy the database. | ||
Then, run `python manage.py migrate` for a new empty | ||
database with tables""" | ||
|
||
|
||
class Command(BaseCommand): | ||
# Show this when the user types help | ||
help = "Loads data from pet_data.csv into our Pet mode" | ||
|
||
def handle(self, *args, **options): | ||
if Vaccine.objects.exists() or Pet.objects.exists(): | ||
print('Pet data already loaded...exiting.') | ||
print(ALREDY_LOADED_ERROR_MESSAGE) | ||
return | ||
print("Creating vaccine data") | ||
for vaccine_name in VACCINES_NAMES: | ||
vac = Vaccine(name=vaccine_name) | ||
vac.save() | ||
print("Loading pet data for pets available for adoption") | ||
for row in DictReader(open('./pet_data.csv')): | ||
pet = Pet() | ||
pet.name = row['Pet'] | ||
pet.submitter = row['Submitter'] | ||
pet.species = row['Species'] | ||
pet.breed = row['Breed'] | ||
pet.description = row['Pet Description'] | ||
pet.sex = row['Sex'] | ||
pet.age = row['Age'] | ||
raw_submission_date = row['submission date'] | ||
submission_date = UTC.localize( | ||
datetime.strptime(raw_submission_date, DATETIME_FORMAT)) | ||
pet.submission_date = submission_date | ||
pet.save() | ||
raw_vaccination_names = row['vaccinations'] | ||
vaccination_names = [name for name in raw_vaccination_names.split('| ') if name] | ||
for vac_name in vaccination_names: | ||
vac = Vaccine.objects.get(name=vac_name) | ||
pet.vaccinations.add(vac) | ||
pet.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Generated by Django 3.0.3 on 2020-02-27 22:56 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Vaccine', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=50)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Pet', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=100)), | ||
('submitter', models.CharField(max_length=100)), | ||
('species', models.CharField(max_length=30)), | ||
('breed', models.CharField(blank=True, max_length=30)), | ||
('description', models.TextField()), | ||
('sex', models.CharField(blank=True, choices=[('M', 'Male'), ('F', 'Female')], max_length=1)), | ||
('submission_date', models.DateTimeField()), | ||
('age', models.IntegerField(null=True)), | ||
('vaccinations', models.ManyToManyField(blank=True, to='adoptions.Vaccine')), | ||
], | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from django.db import models | ||
|
||
class Pet(models.Model): | ||
SEX_CHOICES = [('M', 'Male'), ('F', 'Female')] | ||
name = models.CharField(max_length=100) | ||
submitter = models.CharField(max_length=100) | ||
species = models.CharField(max_length=30) | ||
breed = models.CharField(max_length=30, blank=True) | ||
description = models.TextField() | ||
sex = models.CharField(max_length=1, choices=SEX_CHOICES, blank=True) | ||
submission_date = models.DateTimeField() | ||
age = models.IntegerField(null=True) | ||
vaccinations = models.ManyToManyField('Vaccine', blank=True) | ||
|
||
class Vaccine(models.Model): | ||
name = models.CharField(max_length=50) | ||
|
||
def __str__(self): | ||
return self.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{% load static %} | ||
<html lang="en-US"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Home - Wisdom Pet Medicine</title> | ||
<link rel="stylesheet" id="ample-style-css" href="{% static 'style.css' %}" type="text/css" media="all"> | ||
</head> | ||
<body class="wide"> | ||
<div id="page" class="hfeed site"> | ||
<header> | ||
<div class="header"> | ||
<div class="main-head-wrap inner-wrap clearfix"> | ||
<div id="header-logo-image"> | ||
<a href="/"> | ||
<img src="{% static 'images/logo.png' %}" alt="Wisdom Pet Medicine"> | ||
</a> | ||
</div> | ||
<div id="header-text" class=""> | ||
<h1 id="site-title"> | ||
<a href="/" title="Wisdom Pet Medicine" rel="home">Wisdom Pet Medicine</a> | ||
</h1> | ||
<p>We treat your pets like we treat our own.</p> | ||
</div> | ||
</div> | ||
<img src="{% static 'images/header.jpg' %}" alt="Wisdom Pet Medicine"> | ||
</div> | ||
</header> | ||
<div class="main-wrapper"> | ||
<div class="single-page clearfix"> | ||
<div class="inner-wrap"> | ||
<p>Wisdom Pet Medicine strives to blend the best in traditional and alternative medicine in the diagnosis and treatment of health conditions in companion animals, including dogs, cats, birds, reptiles, rodents, and fish. We apply the latest healthcare technology, along with the wisdom garnered in the centuries old tradition of veterinary medicine, to find the safest and most effective treatments and cures, while maintaining a caring relationship with our patients and their guardians.</p> | ||
<hr> | ||
<div> | ||
{% block content %} | ||
{% endblock %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<footer id="colophon"> | ||
<div class="inner-wrap"> | ||
Wisdom Pet Medicine is a fictitious brand created by Lynda.com, solely for the purpose of training. All products and people associated with Wisdom Pet Medicine are also fictitious. Any resemblance to real brands, products, or people is purely coincidental. Please see your veterinarian for all matters related to your pet's health. | ||
</div> | ||
</footer> | ||
</div> | ||
<script src="{% static 'main.js' %}"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
<div> | ||
{% for pet in pets %} | ||
<div class="petname"> | ||
<a href="{% url 'pet_detail' pet.id %}"> | ||
<h3>{{ pet.name|capfirst }}</h3> | ||
</a> | ||
<p>{{ pet.species }}</p> | ||
{% if pet.breed %} | ||
<p>Breed: {{ pet.breed }}</p> | ||
{% endif %} | ||
<p class="hidden">{{ pet.description }}</p> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
<div> | ||
<h3>{{ pet.name|capfirst }}</h3> | ||
<p>{{ pet.species }}</p> | ||
{% if pet.breed %} | ||
<p>Breed: {{ pet.breed }}</p> | ||
{% endif %} | ||
{% if pet.age %} | ||
<p>Age: {{ pet.age }}</p> | ||
{% endif %} | ||
{% if pet.sex %} | ||
<p>Sex: {{ pet.sex }}</p> | ||
{% endif %} | ||
{% if pet.vaccinations.all %} | ||
<p>Vaccinations for:</p> | ||
<ul> | ||
{% for vaccination in pet.vaccinations.all %} | ||
<li>{{ vaccination.name }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
<p>Submitted by: {{ pet.submitter }}</p> | ||
<p>Submitted on: {{ pet.submission_date|date:"M d Y" }}</p> | ||
<p>{{ pet.description }}</p> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from django.shortcuts import render | ||
from django.http import Http404 | ||
|
||
from .models import Pet | ||
|
||
def home(request): | ||
pets = Pet.objects.all() | ||
return render(request, 'home.html', { | ||
'pets': pets, | ||
}) | ||
|
||
def pet_detail(request, pet_id): | ||
try: | ||
pet = Pet.objects.get(id=pet_id) | ||
except Pet.DoesNotExist: | ||
raise Http404('pet not found') | ||
return render(request, 'pet_detail.html', { | ||
'pet': pet, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python | ||
"""Django's command-line utility for administrative tasks.""" | ||
import os | ||
import sys | ||
|
||
|
||
def main(): | ||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'wisdompets.settings') | ||
try: | ||
from django.core.management import execute_from_command_line | ||
except ImportError as exc: | ||
raise ImportError( | ||
"Couldn't import Django. Are you sure it's installed and " | ||
"available on your PYTHONPATH environment variable? Did you " | ||
"forget to activate a virtual environment?" | ||
) from exc | ||
execute_from_command_line(sys.argv) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Pet,Submitter,Species,Breed,Pet Description,Sex,Age,submission date,vaccinations | ||
Pepe,Reggie Tupp,Rabbit,Cinnamon rabbit,Six-month-old Pepe is very active and is always keeping us on our toes.,M,0,11/28/2016 13:30, | ||
Scooter,Zachary Heilyn,Hedgehog,White-bellied,You have to keep an eye on Scooter because he will climb walls to escape his habitat.,M,2,11/28/2016 14:45, | ||
Zera,Austin Finnagan,Iguana,Cayman brac iguana,"This iguana is on the endangered species list, and is thriving well",F,3,11/29/2016 13:15, | ||
Oddball,Howie Cadell,Guinea pig,American guinea pig,Oddball was the runt of his litter and has some breathing problems but is thriving well.,M,1,11/29/2016 10:00, | ||
Chyna,Sandie Gobnet,Turtle,Terrapin,Chyna got her name because she’s a gentle 13-year-old turtle with a tough shell.,F,13,11/29/2016 14:30, | ||
Rio,Philip Ransu,Dog,French bulldog,"Rio, the 5-year-old bulldog, loves to play ball with his best dog friend, Rudy.",M,5,11/28/2016 10:15,Canine Parvo| Canine Distemper| Canine Rabies| Canine Leptospira | ||
Nadalee,Krystle Valerija,Dog,Chihuahua,"Nadalee is a 7-year-old long hair Chihuahua with a very pleasant, laid back, temperament.",F,7,11/28/2016 16:00,Canine Parvo| Canine Distemper| Canine Rabies| Canine Leptospira | ||
Scout,Nicolette Bardeau,Dog,Jack Russell terrier,Scout suffers from separation anxiety from his former owner but finds comfort in his crate with his favorite toy.,M,5,11/28/2016 09:00,Canine Parvo| Canine Distemper| Canine Rabies| Canine Leptospira | ||
Wesley,Nathan Cayden,Dog,Mixed breed,"At 8 years old there isn’t anything Wesley can’t do, he’s very healthy and full of energy!",M,8,11/29/2016 16:00,Canine Parvo| Canine Distemper| Canine Rabies| Canine Leptospira | ||
Pax,Sarah Greer,Dog,Mixed breed,"Pax is a senior dog and is suffering from arthritic conditions, but doing well for his age.",M,8,11/29/2016 08:30,Canine Parvo| Canine Distemper| Canine Rabies| Canine Leptospira | ||
Sami,Maggie Rickland,Dog,Dalmation,Sami is a very happy go lucky 1-year-old Dalmatian that loves to play.,M,1,12/1/2016 13:00,Canine Parvo| Canine Distemper| Canine Rabies| Canine Leptospira | ||
Casper,Dalania Devitto,Dog,Bichon frise,"Four-year-old Casper was rescued from a breeder when he was 2, and his owner takes great care in giving him a good life.",M,3,12/1/2016 11:30,Canine Parvo| Canine Distemper| Canine Rabies| Canine Leptospira | ||
Tibbs,Shad Cayden,Dog,Dachshund,Tibbs suffers from a spinal condition that can cause immobilization and his owner has to watch his activity levels.,M,10,12/1/2016 8:45,Canine Parvo| Canine Distemper| Canine Rabies| Canine Leptospira | ||
Stich,Dennis Nicholback,Dog,English pointer,Four-year-old Stich was born with a birth defect that required surgery at 6 weeks of age.,M,4,12/2/2016 13:30,Canine Parvo| Canine Distemper| Canine Rabies| Canine Leptospira | ||
Fluffy,Tracy Westbay,Cat,Domestic longhair,"Fluffy is a very fluffy 3-year-old cat, who loves watching cat videos and trying to recreate them.",F,3,11/29/2016 11:45,Feline Herpes Virus 1| Feline Rabies| Feline Leukemia | ||
Squiggles,Madisyn Roope,Cat,Orange tabby cat,"Squiggles was a feral rescue that is now kept as an indoor/outdoor cat, but prefers to be outside.",F,5,11/30/2016 10:15,Feline Herpes Virus 1| Feline Rabies| Feline Leukemia | ||
Lucky,Lisa Choy-Wu,Cat,Tortoiseshell cat,"One-year-old Lucky suffers from a rare heart condition, but has been able to live a relatively normal life.",M,1,11/30/2016 11:30,Feline Herpes Virus 1| Feline Rabies| Feline Leukemia | ||
Bailey,Leslie Richardson,Cat,Persian,Bailey is a 3-year-old female Persian cat that was adopted by her owner as a baby.,F,3,11/30/2016 14:30,Feline Herpes Virus 1| Feline Rabies| Feline Leukemia | ||
Kiko,Kathlyn Zlata,Cat,Tabby cat,Kiko is a very shy 8-year-old cat that was found as a baby under a refrigerator by her mommy.,F,8,11/30/2016 15:45,Feline Herpes Virus 1| Feline Rabies| Feline Leukemia | ||
Shadow,Audry Topsy,Cat,Bombay,Shadow is a 5-year-old cat that gains weight very easily and has to be kept on a special diet.,F,5,12/2/2016 10:15,Feline Herpes Virus 1| Feline Rabies| Feline Leukemia | ||
Felix,Francine Benet,Iguana,Green iguana,Felix is a sly little 6-year-old iguana that is always getting into trouble and keeps his mom on her toes.,M,6,11/30/2016 9:00, | ||
Cosmo,Jennifer Dawson,Bird,Parrot,"Cosmo is possibly the happiest parrot that lived, and loves to sing Happy Birthday to anyone that will listen.",M,8,12/1/2016 10:00, | ||
Chip,Jason Hemlock,Fish,Cichild,Chip is a vivacious 5-year-old African Cichlid with a bit of a temper towards other fish.,M,5,12/1/2016 15:15, | ||
Nugget,Darla Branson,Hamster,Golden hamster,Nugget’s got his name because his owner’s daughter though he looked like a golden nugget when he was a baby.,M,6,12/2/2016 15:00, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var hiddenClass = 'hidden'; | ||
var shownClass = 'toggled-from-hidden'; | ||
|
||
function petSectionHover() { | ||
var children = this.children; | ||
for(var i = 0; i < children.length; i++) { | ||
var child = children[i]; | ||
if (child.className === hiddenClass) { | ||
child.className = shownClass; | ||
} | ||
} | ||
} | ||
|
||
function petSectionEndHover() { | ||
var children = this.children; | ||
for(var i = 0; i < children.length; i++) { | ||
var child = children[i]; | ||
if (child.className === shownClass) { | ||
child.className = hiddenClass; | ||
} | ||
} | ||
} | ||
|
||
(function() { | ||
var petSections = document.getElementsByClassName('petname'); | ||
for(var i = 0; i < petSections.length; i++) { | ||
petSections[i].addEventListener('mouseover', petSectionHover); | ||
petSections[i].addEventListener('mouseout', petSectionEndHover); | ||
} | ||
}()); |
Oops, something went wrong.