Add random mineral button to daily-stone page
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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:
@@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user