Skip to content

Commit 5a72c1f

Browse files
committedOct 15, 2024·
mod5
1 parent e7a38bc commit 5a72c1f

File tree

104 files changed

+2851
-44
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+2851
-44
lines changed
 

‎module3/oop-example/farm.py

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class Dodo(Animal):
4848
class Goat(Animal):
4949
def __init__(self, name, birth_year, birth_month, birth_day, weight, breed):
5050
super().__init__(name, birth_year, birth_month, birth_day, weight)
51+
5152
self.breed = breed
5253
goat_secret_name = "secret goaty goat"
5354
self.goat_secret_name = "secret goaty goat"
@@ -79,6 +80,7 @@ def details(self):
7980
# MAKE EDITS?
8081
# import importlib
8182
# importlib.reload(animals)
83+
8284
#tell them this is dangerous because of variable scopes
8385

8486

‎module4/Lecture4.1.html

-44
Original file line numberDiff line numberDiff line change
@@ -140,50 +140,6 @@ <h3>Structure of a Django Application</h3>
140140
<img src="img/basic-django.png" width="60%" />
141141
<h4 class="fragment"><span class="red">Need to know: Object Oriented Programming in Python!</span></h4>
142142
</section>
143-
144-
<section>
145-
<h3>Django + SQLite </h3>
146-
<pre><code data-trim data-noescape><script type="text/template">
147-
sqlite3 <database_name>
148-
149-
.tables
150-
151-
SELECT * FROM <table_name>;
152-
153-
SELECT * FROM <table_name> WHERE <condition>;
154-
155-
</script></code></pre>
156-
</section>
157-
158-
<section>
159-
<h3>Django + JSON </h3>
160-
161-
<p>Create <a href="https://docs.djangoproject.com/en/3.2/howto/initial-data/">Django fixtures</a>, that is, an "annotated" JSON file:
162-
<pre><code data-trim data-noescape><script type="text/template">
163-
[
164-
{
165-
"model":"cropexplorer.crop",
166-
"pk":"1",
167-
"fields": {
168-
"crop_name": "Millet, Japanese",
169-
"crop_scientific_name": "Echinochloa esculenta",
170-
"cover_crop_group": "Grass",
171-
"family_common_name": "Grass family",
172-
"family_scientific_name": "Poaceae",
173-
"zone_inclusion": "Zone 6,Zone 5,Zone 4",
174-
"crop_description": "Summer annual grass. Can grow in flooded soils and standing water. Adapted to soil with pH as low as 4.5. Prone to premature flowering if seeded late summer. Very responsive to nitrogen. Good smother crop at high seeding rate but may become weed if allowed to go to seed. Mix with cowpeas, soybeans to create a diverse summer mixture. Shorter, finer-stemmed, lower-biomass option compared to sorghum-sudangrass or pearl millet. Does not mow-kill as well and may mature faster\\/reseed more easily than foxtail millet. ",
175-
"heat_tolerance": 5,
176-
"shade_tolerance": 1
177-
}
178-
}
179-
]
180-
</script></code></pre></p>
181-
182-
<p>Bulk Load the data!
183-
<pre><code data-trim data-noescape><script type="text/template">
184-
manage.py loaddata <fixture_file_name>
185-
</script></code></pre></p>
186-
</section>
187143

188144
<section>
189145
<h3>Questions?</h3>

0 commit comments

Comments
 (0)
Please sign in to comment.