Add daily-stone page showing a different mineral each day
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

New dailystone app with 207 minerals scraped from Wikipedia.
Each day displays a different mineral with photos, formula,
properties, description, and history. Page theme color matches
the mineral's typical appearance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-30 18:30:10 +03:00
parent a8ab5f6ce1
commit 0be99e8e9a
20 changed files with 6445 additions and 0 deletions

28
dailystone/views.py Normal file
View File

@@ -0,0 +1,28 @@
from datetime import date
from django.shortcuts import render, get_object_or_404
from .models import Mineral
def daily_stone(request):
today = date.today()
day = today.timetuple().tm_yday
total = Mineral.objects.count()
if total == 0:
return render(request, 'dailystone/stone.html', {'mineral': None})
# Wrap around if we have fewer minerals than days in the year
index = (day - 1) % total + 1
mineral = Mineral.objects.filter(day_of_year=index).first()
# Fallback: pick by modulo of pk list
if not mineral:
minerals = list(Mineral.objects.all())
mineral = minerals[(day - 1) % len(minerals)]
return render(request, 'dailystone/stone.html', {
'mineral': mineral,
'today': today,
})