Example #1
0
def streamitem_index(request, queryset, **kwargs):
    context = {
        'request': request,
        'queryset': queryset.filter(pub_date__lte=datetime.now()).order_by('-pub_date'),
        'paginate_by': settings.STREAMITEMS_PER_PAGE,
        'template_name': 'mainsite/streamitem_archive.html',
        'extra_context': {'allSponsors' : sponsorsList(request)},
    }
    return object_list(**context)
Example #2
0
def myvictim(request, game):

   try:
      current_round = Game.objects.get(slug=game).round_set.get(start__lt=datetime.now, end__gt=datetime.now())

      rp = current_round.roundplayer_set.get(player=Player.objects.get(username=request.user.username))   

      if not rp.alive:
         return render_to_response('basic.html', RequestContext(request, { 'title':'You are DEAD. See you next week!', 'allSponsors' : sponsorsList(request) }))

      flash = ''
      if request.method == 'POST':
         form = KillForm(request.POST)
         if form.is_valid():
            password = form.cleaned_data['password']
            if password == current_round.roundplayer_set.get(player=rp.currentvictim).password.text:
               k = Kill(round=current_round, killer=rp.player)
               k.save()
               flash = 'Good Kill!'
               rp = current_round.roundplayer_set.get(player=Player.objects.get(username=request.user.username))   
            else:
               flash = 'Wrong Password!'
      else:
         form = KillForm()

      return render_to_response('myvictim.html', 
            RequestContext(request, {'victim':rp.currentvictim, 'gameslug':game, 'flash':flash, 'form':form, 'allSponsors' : sponsorsList(request)}))

   except Round.DoesNotExist:
      return render_to_response('basic.html', RequestContext(request, { 'title':'No Current Round. Go Away!', 'allSponsors' : sponsorsList(request) }))
   except Game.DoesNotExist:
      return render_to_response('basic.html', RequestContext(request, { 'title':'Invalid Game. Go Away!', 'allSponsors' : sponsorsList(request) }))
   except RoundPlayer.DoesNotExist:
      return render_to_response('basic.html', RequestContext(request, { 'title':'You are not registered in this round. Go Away!', 'allSponsors' : sponsorsList(request) }))
   except Player.DoesNotExist:
      return render_to_response('basic.html', RequestContext(request, { 'title':'You are not registered in this game. Go Away!', 'allSponsors' : sponsorsList(request) }))
Example #3
0
def roundkills(request, game, roundid):
   return render_to_response('basic.html', RequestContext(request, { 'title':'roundkills', 'allSponsors' : sponsorsList(request) }))
Example #4
0
def newkills(request, game):
   try:
      c = defaultdict(int)
      gameo = Game.objects.get(slug=game)
      kills = gameo.round_set.get(start__lt=datetime.now, end__gt=datetime.now()).kill_set.order_by('-datetime')
      return render_to_response('newkills.html', RequestContext(request, { 'game': gameo, 'kills': kills, 'allSponsors' : sponsorsList(request) }))

   except Round.DoesNotExist:
      return render_to_response('basic.html', RequestContext(request, { 'title':'No Current Round. Go Away!', 'allSponsors' : sponsorsList(request) }))
   except Game.DoesNotExist:
      return render_to_response('basic.html', RequestContext(request, { 'title':'Invalid Game. Go Away!', 'allSponsors' : sponsorsList(request) }))
Example #5
0
def scoreboard(request, game):
   try:
      c = defaultdict(int)
      gameo = Game.objects.get(slug=game)
      total = 0
      for round in gameo.round_set.all():
         for kill in round.kill_set.all():
            c[kill.killer.username] += 1
            total += 1
      counts = sorted(c.iteritems(), key = lambda (k,v):(v,k), reverse=True)
      return render_to_response('scoreboard.html', RequestContext(request, { 'game': gameo, 'counts': counts, 'total': total, 'allSponsors' : sponsorsList(request) }))
   except Game.DoesNotExist:
      return render_to_response('basic.html', RequestContext(request, { 'title':'Invalid Game. Go Away!', 'allSponsors' : sponsorsList(request) }))
Example #6
0
def index(request, game):
   try:
      return render_to_response('index.html', RequestContext(request, { 'game': Game.objects.get(slug=game), 'allSponsors' : sponsorsList(request) }))
   except Game.DoesNotExist:
      return render_to_response('basic.html', RequestContext(request, { 'title':'Invalid Game. Go Away!', 'allSponsors' : sponsorsList(request) }))
Example #7
0
def gamelist(request):
   return render_to_response('games.html', RequestContext(request, { 'games': Game.objects.order_by('id'), 'allSponsors' : sponsorsList(request) }))
Example #8
0
def static(request, path):
    p = get_object_or_404(Static, slug=path.replace('/','_'))
    template=p.template.replace('templates/', '', 1)
    return render_to_response(template, { 'allSponsors' : sponsorsList(request), 'object' : p }, context_instance=RequestContext(request) )
Example #9
0
def static(request, path):
    p = get_object_or_404(Static, slug=path.replace('/','_'))
    #until the database gets fixed
    import re
    template = re.sub(r'.*templates/', '', p.template)
    return render_to_response(template, { 'allSponsors' : sponsorsList(request), 'object' : p }, context_instance=RequestContext(request) )