Ejemplo n.º 1
0
def approval(request):
    date_array = get_date_list()
    if request.method == 'POST':
        for item in request.POST:
            if "date" in item:
                item = item.replace('date','')
                date = item[0]
                item = item[1:]
                item = item.replace('slot','')
                slot = item[0]
                item = item[1:]
                item = item.replace('team','')
                team = item
                item = "date"+date+"slot"+slot
                team = int(request.POST[item]) 
                date=date_array[int(date)-1]
                team = MusicRoomTeam.objects.get(id=int(team))
                slot = MusicRoomSlot.objects.get(date=date,slot=int(slot))
                slot.approved_team = team
                slot.save()
                messages.success(request,'All changes saved')
                try:
                    send_mail('Litsoc Portal : Music Room request approved', email_body , '*****@*****.**',[email], fail_silently=False)
                except:
                    pass
    to_return={
        'title':'Musicroom Approval',
    }
    return render_to_response("clubs/musicroomlist.html",to_return,context_instance=RequestContext(request))
Ejemplo n.º 2
0
def litsoc_context(request):
    response = {'book_list':'',}        
    date_array = get_date_list()
    book_list = get_book_array(date_array)
    response['book_list'] = zip(date_array,book_list)
    return response