<commit_before>from datetime import datetime

from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse

from sendinel.backend.models import Usergroup, ScheduledEvent, InfoMessage
from sendinel.staff.forms import InfoMessageForm

@login_required
def index(request):
    return render_to_response('index.html',
                              context_instance=RequestContext(request))
  
@login_required
def create_infomessage(request, id):
       
    if(request.method == "GET"):
        form = InfoMessageForm()
    
        return render_to_response("create_infomessage.html",
                                    locals(),
                                    context_instance = RequestContext(request))
    elif(request.method == "POST"):
        
        info_message = InfoMessage()
        
        info_message.text = request.REQUEST["text"]
        info_message.recipient = Usergroup.objects.filter(pk = id)[0]
        info_message.way_of_communication = "voicecall"

        info_message.save()        
        info_message.create_scheduled_event(datetime.now())
        
        return HttpResponseRedirect(reverse("staff_list_infoservices"))

    
@login_required
def list_infoservices(request):

    all_groups = Usergroup.objects.all()

    groups = []
    
    for group in all_groups:
        groups.append({
            "id": group.id,
            "name": group.name, 
            "count_members": group.members.all().count()
        })
            
    return render_to_response("list_infoservices.html",
                                locals(),
                                context_instance = RequestContext(request))<commit_msg>- changed way of communication to voice for infomessages<commit_after>from datetime import datetime

from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse

from sendinel.backend.models import Usergroup, ScheduledEvent, InfoMessage
from sendinel.staff.forms import InfoMessageForm

@login_required
def index(request):
    return render_to_response('index.html',
                              context_instance=RequestContext(request))
  
@login_required
def create_infomessage(request, id):
       
    if(request.method == "GET"):
        form = InfoMessageForm()
    
        return render_to_response("create_infomessage.html",
                                    locals(),
                                    context_instance = RequestContext(request))
    elif(request.method == "POST"):
        
        info_message = InfoMessage()
        
        info_message.text = request.REQUEST["text"]
        info_message.recipient = Usergroup.objects.filter(pk = id)[0]
        info_message.way_of_communication = "voice"

        info_message.save()        
        info_message.create_scheduled_event(datetime.now())
        
        return HttpResponseRedirect(reverse("staff_list_infoservices"))

    
@login_required
def list_infoservices(request):

    all_groups = Usergroup.objects.all()

    groups = []
    
    for group in all_groups:
        groups.append({
            "id": group.id,
            "name": group.name, 
            "count_members": group.members.all().count()
        })
            
    return render_to_response("list_infoservices.html",
                                locals(),
                                context_instance = RequestContext(request))
{'fraction_non_alphanumeric': 0.08353609083536091, 'fraction_numerical': 0.0005406866720735334, 'mean_word_length': 2.4132841328413286, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6852137', 'n_tokens_mistral': 952, 'n_tokens_neox': 936, 'n_words': 187}