Advertisement
spliter93

Untitled

Jun 14th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.93 KB | None | 0 0
  1. from django.contrib.auth.models import Group, Permission
  2. from django.contrib.contenttypes.models import ContentType
  3.  
  4. from meals.models import *
  5. import random
  6.  
  7. random_food_list = '''
  8. Cucumber Salad With Sour Cream and Garlic
  9. Schnitzel
  10. Lasagne
  11. Gazpacho
  12. Tacos
  13. Coleslaw
  14. Quiche
  15. Apple Pie
  16. Cucumber Sandwiches
  17. Tiramisu
  18. Beef Wellington
  19. Gyros
  20. Hollandaise Sauce
  21. Chicken Noodle Soup
  22. French Onion Soup
  23. Fried Egg
  24. Aioli
  25. Eggs Benedict
  26. Souvlaki
  27. Chicken Nuggets
  28. Chili
  29. Mayonaise
  30. Cucumber Salad With Sour Cream and Garlic
  31. Honeymelon With Ham
  32. Pumpkin Soup
  33. Creme Brulee
  34. Lasagne
  35. Mashed Potato
  36. Spaetzle
  37. Bratkartoffeln
  38. Ravioli
  39. Beef Wellington
  40. Steak
  41. Duck
  42. Risotto
  43. Sweet & Sour Chicken (Cantonese Style)
  44. Chicken Noodle Soup
  45. Roast Chicken
  46. Ratatouille
  47. Gyros
  48. Fresh Spring Rolls
  49. Chicken Tikka Masala
  50. Roast Chicken
  51. Honeymelon With Ham
  52. Wrap
  53. Fresh Spring Rolls
  54. Porridge
  55. Spaghetti Bolognese
  56. Quesadilla
  57. Chicken Nuggets
  58. French Toast
  59. Macaroni Salad
  60. Gazpacho
  61. Chicken Wings
  62. Risotto
  63. Paella
  64. Sweet & Sour Chicken (Cantonese Style)
  65. Goulash
  66. Bratkartoffeln
  67. Barbecue
  68. Chicken Noodle Soup
  69. Bangers & Mash
  70. Falafal
  71. '''
  72.  
  73. admin = User.objects.create_superuser(
  74.     'admin', 'admin@admin.com', 'test', Country.objects.get(pk=100),
  75.     Group.objects.get(name='admin')
  76. )
  77.  
  78. mod = User.objects.create_superuser(
  79.     'moderator', 'moderator@moderator.com', 'test', Country.objects.get(pk=42),
  80.     Group.objects.get(name='moderator')
  81. )
  82. reg = User.objects.create_superuser(
  83.     'regular', 'regular@regular.com', 'test', Country.objects.get(pk=24),
  84.     Group.objects.get(name='regular_user')
  85. )
  86.  
  87. names = random_food_list.split('\n')
  88. names = [n for n in names if n.strip()]
  89.  
  90. for n in names:
  91.     type = MealType.objects.order_by('?').first()
  92.     user = User.objects.order_by('?').first()
  93.     public = random.choice([True, False])
  94.     calories = random.randint(44, 620)
  95.     meal = Meal.objects.create(title=n, type=type, user=user, public=public)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement