views.py 321 B

1234567891011
  1. from random import sample
  2. from django.shortcuts import render
  3. def show_index(request):
  4. fruits = [
  5. 'Apple', 'Orange', 'Pitaya', 'Durian', 'Waxberry', 'Blueberry',
  6. 'Grape', 'Peach', 'Pear', 'Banana', 'Watermelon', 'Mango'
  7. ]
  8. return render(request, 'index.html', {'fruits': sample(fruits, 3)})