Skip to content

Instantly share code, notes, and snippets.

@blite
Created April 7, 2011 16:01
Show Gist options
  • Save blite/908072 to your computer and use it in GitHub Desktop.
Save blite/908072 to your computer and use it in GitHub Desktop.
current_user = random.choice(users)
site = Site.objects.filter(created_by=current_user).order_by('?')[0]
try:
keyword = Keyword.objects.filter(url__site=site).order_by('?')[0]
except Exception:
#some sites have no keywords
keyword = Keyword.objects.filter(url__created_by=current_user).order_by('?')[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment