Django 1.7 mostly working. Big refactor so probably bugs

This commit is contained in:
Sam Wenham
2018-04-15 16:28:13 +01:00
parent 7877efba0a
commit 798ae591c6
18 changed files with 82 additions and 60 deletions

View File

@@ -1,14 +1,14 @@
from django.conf import settings
import random, re, logging
from core.models import CaveDescription
from troggle.core.models import CaveDescription
def weighted_choice(lst):
n = random.uniform(0,1)
for item, weight in lst:
if n < weight:
break
n = n - weight
return item
n = random.uniform(0,1)
for item, weight in lst:
if n < weight:
break
n = n - weight
return item
def randomLogbookSentence():
from troggle.core.models import LogbookEntry