16 lines
495 B
Python
16 lines
495 B
Python
|
from .models import Acronym
|
||
|
import random
|
||
|
|
||
|
def random_title(request):
|
||
|
count = Acronym.objects.count()
|
||
|
random_c = random.randint(1, count)
|
||
|
random_a = random.randint(1, count)
|
||
|
random_m = random.randint(1, count)
|
||
|
random_p = random.randint(1, count)
|
||
|
c = Acronym.objects.all()[random_c].c
|
||
|
a = Acronym.objects.all()[random_a].a
|
||
|
m = Acronym.objects.all()[random_m].m
|
||
|
p = Acronym.objects.all()[random_p].p
|
||
|
return {
|
||
|
'RANDOM_TITLE': f"{c} {a} {m} {p}"
|
||
|
}
|