bloombase/plants/models.py
Stephan Kerkman a60c99ed93 feat: replace pruning UI with bloom months
- Add bloom_months to Plant and Species models (migration 0003)
- Swap pruning_months form field for bloom_months throughout
- Plant detail shows green bloom strip instead of pruning strip
- Dashboard shows 'Blooming now' count and list instead of overdue pruning
- Remove ✂️ pruning calendar from nav (feature hidden, backend intact)
- Update dashboard tests to reflect new context

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 17:03:25 +02:00

59 lines
2 KiB
Python

from django.db import models
class Species(models.Model):
common_name = models.CharField(max_length=200)
scientific_name = models.CharField(max_length=200, blank=True)
description = models.TextField(blank=True)
watering = models.CharField(max_length=100, blank=True)
sunlight = models.CharField(max_length=200, blank=True)
shadow_tolerance = models.CharField(max_length=100, blank=True)
max_height_cm = models.PositiveIntegerField(null=True, blank=True)
growth_rate = models.CharField(max_length=100, blank=True)
growth_season = models.CharField(max_length=100, blank=True)
pruning_months = models.JSONField(default=list)
bloom_months = models.JSONField(default=list)
api_image_url = models.URLField(blank=True)
perenual_id = models.IntegerField(unique=True, null=True, blank=True)
class Meta:
ordering = ['common_name']
verbose_name_plural = 'species'
def __str__(self):
return self.common_name
class Plant(models.Model):
name = models.CharField(max_length=200)
species = models.ForeignKey(
Species, null=True, blank=True,
on_delete=models.SET_NULL, related_name='plants',
)
location = models.CharField(max_length=200)
is_indoor = models.BooleanField(default=False)
pruning_months = models.JSONField(default=list)
bloom_months = models.JSONField(default=list)
photo = models.ImageField(upload_to='plants/', blank=True)
notes = models.TextField(blank=True)
date_added = models.DateField(auto_now_add=True)
class Meta:
ordering = ['name']
def __str__(self):
return self.name
class PruningLog(models.Model):
plant = models.ForeignKey(
Plant, on_delete=models.CASCADE, related_name='pruning_logs',
)
pruned_on = models.DateField()
notes = models.TextField(blank=True)
class Meta:
ordering = ['-pruned_on']
def __str__(self):
return f'{self.plant.name} pruned on {self.pruned_on}'