summaryrefslogtreecommitdiff
path: root/bak/unused_apps/garden
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
committerluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
commit9a620cf42bf1fe6977e378bd834b41ff4a593dde (patch)
treecf41a0582681cecaf88a30bfe409f9c2be57972a /bak/unused_apps/garden
parent6e5897117124cd60ae81efb1574c6347f48e60e5 (diff)
main: removed some apps I wasn't using and added bak to git to preserve
a copy of old apps
Diffstat (limited to 'bak/unused_apps/garden')
-rw-r--r--bak/unused_apps/garden/admin.py38
-rw-r--r--bak/unused_apps/garden/migrations/0001_initial.py91
-rw-r--r--bak/unused_apps/garden/migrations/0002_plant_family.py18
-rw-r--r--bak/unused_apps/garden/migrations/0003_auto_20200705_1629.py18
-rw-r--r--bak/unused_apps/garden/migrations/0004_auto_20200705_1650.py59
-rw-r--r--bak/unused_apps/garden/migrations/0005_auto_20200705_1652.py24
-rw-r--r--bak/unused_apps/garden/migrations/0006_auto_20200706_0854.py23
-rw-r--r--bak/unused_apps/garden/migrations/0007_auto_20200706_0854.py18
-rw-r--r--bak/unused_apps/garden/migrations/__init__.py0
-rw-r--r--bak/unused_apps/garden/models.py153
10 files changed, 442 insertions, 0 deletions
diff --git a/bak/unused_apps/garden/admin.py b/bak/unused_apps/garden/admin.py
new file mode 100644
index 0000000..0f9c8d0
--- /dev/null
+++ b/bak/unused_apps/garden/admin.py
@@ -0,0 +1,38 @@
+from django.contrib import admin
+from django.contrib.contenttypes.admin import GenericStackedInline
+
+from utils.widgets import AdminImageWidget, LGEntryForm
+from .models import Plant, Planting, Seed
+
+
+@admin.register(Plant)
+class PlantAdmin(admin.ModelAdmin):
+ form = LGEntryForm
+
+ list_display = ('name', 'family', 'growth_time')
+ list_filter = ('family', 'edible', 'conditions', 'heirloom')
+
+ class Media:
+ js = ('image-loader.js', 'next-prev-links.js')
+ css = {
+ "all": ("my_styles.css",)
+ }
+
+
+@admin.register(Planting)
+class PlantingAdmin(admin.ModelAdmin):
+ form = LGEntryForm
+
+ list_display = ('plant', 'family', 'number_of_plants', 'date_seed_started', 'date_seed_sprouted', 'date_hardened_off', 'date_planted', 'seed_start_area','garden_area', 'outcome')
+ list_filter = ('plant__family', 'date_seed_started', 'garden_area', 'seed_start_area', 'outcome')
+
+ class Media:
+ js = ('image-loader.js', 'next-prev-links.js')
+ css = {
+ "all": ("my_styles.css",)
+ }
+
+
+@admin.register(Seed)
+class PlantAdmin(admin.ModelAdmin):
+ form = LGEntryForm
diff --git a/bak/unused_apps/garden/migrations/0001_initial.py b/bak/unused_apps/garden/migrations/0001_initial.py
new file mode 100644
index 0000000..d73d80d
--- /dev/null
+++ b/bak/unused_apps/garden/migrations/0001_initial.py
@@ -0,0 +1,91 @@
+# Generated by Django 2.1.2 on 2020-07-05 16:18
+
+import datetime
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Guild',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(blank=True, max_length=200)),
+ ('seperation', models.PositiveIntegerField()),
+ ('notes', models.TextField(blank=True, null=True)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Plant',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(max_length=200)),
+ ('scientific_name', models.CharField(max_length=200)),
+ ('edible', models.BooleanField(default=False)),
+ ('date_created', models.DateTimeField(default=datetime.datetime.now)),
+ ('growth_time', models.PositiveIntegerField()),
+ ('germination_time', models.PositiveIntegerField()),
+ ('seperation', models.PositiveIntegerField()),
+ ('notes', models.TextField(blank=True, null=True)),
+ ('conditions', models.IntegerField(choices=[(0, 'Direct Sun'), (1, 'Part Sun'), (2, 'Shade')], default=0)),
+ ('organic', models.BooleanField(default=True)),
+ ('heirloom', models.BooleanField(default=True)),
+ ],
+ options={
+ 'ordering': ('-date_created',),
+ 'get_latest_by': 'date_created',
+ },
+ ),
+ migrations.CreateModel(
+ name='Planting',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('seed_start_area', models.IntegerField(choices=[(0, 'Indoors'), (1, 'Direct Sow'), (2, 'Greenhouse')], default=0)),
+ ('date_seed_started', models.DateField(verbose_name='Date published')),
+ ('date_seed_sprouted', models.DateField(verbose_name='Date published')),
+ ('date_hardened_off', models.DateField(verbose_name='Date published')),
+ ('date_planted', models.DateField(verbose_name='Date published')),
+ ('garden_area', models.IntegerField(choices=[(0, 'Far Plot Mound'), (1, 'Far Plot ground'), (2, 'Herb Plot half mound')], default=0)),
+ ('notes', models.TextField(blank=True, null=True)),
+ ('plant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='garden.Plant')),
+ ],
+ options={
+ 'ordering': ('-date_seed_started',),
+ 'get_latest_by': 'date_seed_started',
+ },
+ ),
+ migrations.CreateModel(
+ name='Seed',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('brand', models.CharField(max_length=200)),
+ ('date_created', models.DateTimeField(default=datetime.datetime.now)),
+ ('estimated_growth_time', models.PositiveIntegerField()),
+ ('estimated_germination_time', models.PositiveIntegerField()),
+ ('organic', models.BooleanField(default=True)),
+ ('notes', models.TextField(blank=True, null=True)),
+ ('plant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='garden.Plant')),
+ ],
+ options={
+ 'ordering': ('-date_created',),
+ 'get_latest_by': 'date_created',
+ },
+ ),
+ migrations.AddField(
+ model_name='planting',
+ name='seed',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='garden.Seed'),
+ ),
+ migrations.AddField(
+ model_name='guild',
+ name='plant',
+ field=models.ManyToManyField(to='garden.Plant'),
+ ),
+ ]
diff --git a/bak/unused_apps/garden/migrations/0002_plant_family.py b/bak/unused_apps/garden/migrations/0002_plant_family.py
new file mode 100644
index 0000000..db81791
--- /dev/null
+++ b/bak/unused_apps/garden/migrations/0002_plant_family.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.2 on 2020-07-05 16:27
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('garden', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='plant',
+ name='family',
+ field=models.IntegerField(choices=[(0, 'Tomatoes'), (1, 'Cucumbers'), (2, 'Watermelons'), (3, 'Pumkins'), (4, 'Basil')], default=0),
+ ),
+ ]
diff --git a/bak/unused_apps/garden/migrations/0003_auto_20200705_1629.py b/bak/unused_apps/garden/migrations/0003_auto_20200705_1629.py
new file mode 100644
index 0000000..ed0eb01
--- /dev/null
+++ b/bak/unused_apps/garden/migrations/0003_auto_20200705_1629.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.2 on 2020-07-05 16:29
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('garden', '0002_plant_family'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='plant',
+ name='scientific_name',
+ field=models.CharField(max_length=200, null=True),
+ ),
+ ]
diff --git a/bak/unused_apps/garden/migrations/0004_auto_20200705_1650.py b/bak/unused_apps/garden/migrations/0004_auto_20200705_1650.py
new file mode 100644
index 0000000..6e9ea63
--- /dev/null
+++ b/bak/unused_apps/garden/migrations/0004_auto_20200705_1650.py
@@ -0,0 +1,59 @@
+# Generated by Django 2.1.2 on 2020-07-05 16:50
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('garden', '0003_auto_20200705_1629'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='planting',
+ name='number_of_plants',
+ field=models.PositiveIntegerField(default=1),
+ preserve_default=False,
+ ),
+ migrations.AddField(
+ model_name='planting',
+ name='outcome',
+ field=models.IntegerField(choices=[(0, 'Far Plot Mound'), (1, 'Far Plot ground'), (2, 'Herb Plot ground'), (2, 'Herb Plot bed')], default=0),
+ ),
+ migrations.AlterField(
+ model_name='plant',
+ name='scientific_name',
+ field=models.CharField(blank=True, max_length=200, null=True),
+ ),
+ migrations.AlterField(
+ model_name='planting',
+ name='date_hardened_off',
+ field=models.DateField(blank=True, null=True),
+ ),
+ migrations.AlterField(
+ model_name='planting',
+ name='date_planted',
+ field=models.DateField(),
+ ),
+ migrations.AlterField(
+ model_name='planting',
+ name='date_seed_sprouted',
+ field=models.DateField(blank=True, null=True),
+ ),
+ migrations.AlterField(
+ model_name='planting',
+ name='date_seed_started',
+ field=models.DateField(blank=True, null=True),
+ ),
+ migrations.AlterField(
+ model_name='planting',
+ name='garden_area',
+ field=models.IntegerField(choices=[(0, 'Far Plot Mound'), (1, 'Far Plot ground'), (2, 'Herb Plot ground'), (2, 'Herb Plot bed')], default=0),
+ ),
+ migrations.AlterField(
+ model_name='planting',
+ name='seed_start_area',
+ field=models.IntegerField(choices=[(0, 'Indoors'), (1, 'Direct Sow'), (2, 'Greenhouse'), (2, 'Purchased Seedling')], default=0),
+ ),
+ ]
diff --git a/bak/unused_apps/garden/migrations/0005_auto_20200705_1652.py b/bak/unused_apps/garden/migrations/0005_auto_20200705_1652.py
new file mode 100644
index 0000000..22bebaf
--- /dev/null
+++ b/bak/unused_apps/garden/migrations/0005_auto_20200705_1652.py
@@ -0,0 +1,24 @@
+# Generated by Django 2.1.2 on 2020-07-05 16:52
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('garden', '0004_auto_20200705_1650'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='planting',
+ name='outcome',
+ field=models.IntegerField(choices=[(0, 'Unknown'), (1, 'Success'), (2, 'Moderate Success'), (3, 'Fail')], default=0),
+ ),
+ migrations.AlterField(
+ model_name='planting',
+ name='seed',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='garden.Seed'),
+ ),
+ ]
diff --git a/bak/unused_apps/garden/migrations/0006_auto_20200706_0854.py b/bak/unused_apps/garden/migrations/0006_auto_20200706_0854.py
new file mode 100644
index 0000000..a036635
--- /dev/null
+++ b/bak/unused_apps/garden/migrations/0006_auto_20200706_0854.py
@@ -0,0 +1,23 @@
+# Generated by Django 2.1.2 on 2020-07-06 08:54
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('garden', '0005_auto_20200705_1652'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='plant',
+ name='annual',
+ field=models.BooleanField(default=True),
+ ),
+ migrations.AlterField(
+ model_name='plant',
+ name='family',
+ field=models.IntegerField(choices=[(0, 'Tomatoes'), (1, 'Cucumbers'), (2, 'Watermelons'), (3, 'Pumkins'), (4, 'Cantelope'), (5, 'Kale'), (6, 'Okra'), (7, 'Collards'), (8, 'Arugula'), (9, 'Butter Lettuce'), (10, 'Basil'), (11, 'Lemongrass'), (12, 'Thyme'), (13, 'Mint')], default=0),
+ ),
+ ]
diff --git a/bak/unused_apps/garden/migrations/0007_auto_20200706_0854.py b/bak/unused_apps/garden/migrations/0007_auto_20200706_0854.py
new file mode 100644
index 0000000..94f85e7
--- /dev/null
+++ b/bak/unused_apps/garden/migrations/0007_auto_20200706_0854.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.2 on 2020-07-06 08:54
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('garden', '0006_auto_20200706_0854'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='plant',
+ name='conditions',
+ field=models.IntegerField(choices=[(0, 'Vegetable'), (1, 'Herb'), (2, 'Berry'), (3, 'Nut')], default=0),
+ ),
+ ]
diff --git a/bak/unused_apps/garden/migrations/__init__.py b/bak/unused_apps/garden/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bak/unused_apps/garden/migrations/__init__.py
diff --git a/bak/unused_apps/garden/models.py b/bak/unused_apps/garden/models.py
new file mode 100644
index 0000000..56e8c30
--- /dev/null
+++ b/bak/unused_apps/garden/models.py
@@ -0,0 +1,153 @@
+import datetime
+
+from django.contrib.gis.db import models
+
+from utils.util import render_images, markdown_to_html
+
+
+PLANT_FAMILY = (
+ (0, 'Tomatoes'),
+ (1, 'Cucumbers'),
+ (2, 'Watermelons'),
+ (3, 'Pumkins'),
+ (4, 'Cantelope'),
+ (5, 'Kale'),
+ (6, 'Okra'),
+ (7, 'Collards'),
+ (8, 'Arugula'),
+ (9, 'Butter Lettuce'),
+ (10, 'Basil'),
+ (11, 'Lemongrass'),
+ (12, 'Thyme'),
+ (13, 'Mint'),
+)
+
+
+class Plant(models.Model):
+ """
+ Model to hold Plant Definitions
+ """
+ name = models.CharField(max_length=200)
+ family = models.IntegerField(choices=PLANT_FAMILY, default=0)
+ scientific_name = models.CharField(max_length=200, null=True, blank=True)
+ edible = models.BooleanField(default=False)
+ date_created = models.DateTimeField(default=datetime.datetime.now)
+ growth_time = models.PositiveIntegerField()
+ germination_time = models.PositiveIntegerField()
+ seperation = models.PositiveIntegerField()
+ notes = models.TextField(null=True, blank=True)
+ CONDITIONS = (
+ (0, 'Direct Sun'),
+ (1, 'Part Sun'),
+ (2, 'Shade'),
+ )
+ conditions = models.IntegerField(choices=CONDITIONS, default=0)
+ PLANT_TYPE= (
+ (0, 'Vegetable'),
+ (1, 'Herb'),
+ (2, 'Berry'),
+ (3, 'Nut'),
+ )
+ conditions = models.IntegerField(choices=PLANT_TYPE, default=0)
+ organic = models.BooleanField(default=True)
+ heirloom = models.BooleanField(default=True)
+ annual = models.BooleanField(default=True)
+
+ class Meta:
+ ordering = ('-date_created',)
+ get_latest_by = 'date_created'
+
+ def __str__(self):
+ return self.name
+
+
+class Seed(models.Model):
+ plant = models.ForeignKey(Plant, on_delete=models.CASCADE)
+ brand = models.CharField(max_length=200)
+ date_created = models.DateTimeField(default=datetime.datetime.now)
+ estimated_growth_time = models.PositiveIntegerField()
+ estimated_germination_time = models.PositiveIntegerField()
+ organic = models.BooleanField(default=True)
+ notes = models.TextField(null=True, blank=True)
+
+ class Meta:
+ ordering = ('-date_created',)
+ get_latest_by = 'date_created'
+
+ def __str__(self):
+ return self.plant.name
+
+
+class Planting(models.Model):
+ plant = models.ForeignKey(Plant, on_delete=models.CASCADE)
+ number_of_plants = models.PositiveIntegerField()
+ seed = models.ForeignKey(Seed, on_delete=models.CASCADE, null=True, blank=True)
+ START_AREA = (
+ (0, 'Indoors'),
+ (1, 'Direct Sow'),
+ (2, 'Greenhouse'),
+ (2, 'Purchased Seedling'),
+ )
+ seed_start_area = models.IntegerField(choices=START_AREA, default=0)
+ date_seed_started = models.DateField(null=True, blank=True)
+ date_seed_sprouted = models.DateField(null=True, blank=True)
+ date_hardened_off = models.DateField(null=True, blank=True)
+ date_planted = models.DateField()
+ GARDEN_PLOT = (
+ (0, 'Far Plot Mound'),
+ (1, 'Far Plot ground'),
+ (2, 'Herb Plot ground'),
+ (2, 'Herb Plot bed'),
+ )
+ garden_area = models.IntegerField(choices=GARDEN_PLOT, default=0)
+ OUTCOME = (
+ (0, 'Unknown'),
+ (1, 'Success'),
+ (2, 'Moderate Success'),
+ (3, 'Fail'),
+ )
+ outcome = models.IntegerField(choices=OUTCOME, default=0)
+ notes = models.TextField(null=True, blank=True)
+
+ class Meta:
+ ordering = ('-date_seed_started',)
+ get_latest_by = 'date_seed_started'
+
+ def __str__(self):
+ return self.plant.name
+
+ @property
+ def get_previous_admin_url(self):
+ n = self.get_previous_by_pub_date()
+ return reverse('admin:%s_%s_change' %(self._meta.app_label, self._meta.model_name), args=[n.id] )
+
+ @property
+ def get_next_admin_url(self):
+ model = apps.get_model(app_label=self._meta.app_label, model_name=self._meta.model_name)
+ try:
+ return reverse('admin:%s_%s_change' %(self._meta.app_label, self._meta.model_name), args=[self.get_next_by_pub_date().pk] )
+ except model.DoesNotExist:
+ return ''
+
+
+ @property
+ def family(self):
+ return self.plant.get_family_display()
+
+
+ def save(self, *args, **kwargs):
+ created = self.pk is None
+ if not created:
+ md = render_images(self.notes)
+ self.body_html = markdown_to_html(md)
+ super(Planting, self).save(*args, **kwargs)
+
+
+class Guild(models.Model):
+ name = models.CharField(max_length=200, blank=True)
+ plant = models.ManyToManyField(Plant)
+ seperation = models.PositiveIntegerField()
+ notes = models.TextField(null=True, blank=True)
+
+ def __str__(self):
+ return self.name