Add random mineral button to daily-stone page
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-30 22:03:43 +03:00
parent 0be99e8e9a
commit 44e2420c29
3 changed files with 51 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
from datetime import date
from django.shortcuts import render, get_object_or_404
from django.shortcuts import render, redirect
from django.urls import reverse
from .models import Mineral
@@ -26,3 +27,14 @@ def daily_stone(request):
'mineral': mineral,
'today': today,
})
def random_stone(request):
mineral = Mineral.objects.order_by('?').first()
if not mineral:
return redirect('dailystone:daily_stone')
return render(request, 'dailystone/stone.html', {
'mineral': mineral,
'today': date.today(),
'is_random': True,
})