<commit_before>from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from gnowsys_ndf.ndf.models import get_database
from gnowsys_ndf.ndf.models import Node
from django.contrib.auth.models import User
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.template.loader import render_to_string
from django.contrib.sites.models import Site

import json

try:
    from bson import ObjectId
except ImportError:  # old pymongo
    from pymongo.objectid import ObjectId

db = get_database()
col_Group = db[Node.collection_name]
sitename=Site.objects.all()[0]

def ratings(request,group_id):
    rating=request.POST['rating']
    node=col_Group.Node.one({'_id':ObjectId(group_id)})
    ratedict={}
    ratedict['score']=int(rating)
    ratedict['user_id']=request.user.id
    ratedict['ip_address']=request.META['REMOTE_ADDR']
    fl=0
    for each in node.rating:
        if each['user_id'] == request.user.id:
            each['score']=int(rating)<commit_msg>Error MultiValueDictKeyError: 'rating' is resolved.<commit_after>from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from gnowsys_ndf.ndf.models import get_database
from gnowsys_ndf.ndf.models import Node
from django.contrib.auth.models import User
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.template.loader import render_to_string
from django.contrib.sites.models import Site

import json

try:
    from bson import ObjectId
except ImportError:  # old pymongo
    from pymongo.objectid import ObjectId

db = get_database()
col_Group = db[Node.collection_name]
sitename=Site.objects.all()[0]

def ratings(request,group_id):
    rating=request.POST.get('rating', '')
    node=col_Group.Node.one({'_id':ObjectId(group_id)})
    ratedict={}
    ratedict['score']=int(rating)
    ratedict['user_id']=request.user.id
    ratedict['ip_address']=request.META['REMOTE_ADDR']
    fl=0
    for each in node.rating:
        if each['user_id'] == request.user.id:
            each['score']=int(rating)
{'fraction_non_alphanumeric': 0.1008174386920981, 'fraction_numerical': 0.0018165304268846503, 'mean_word_length': 5.1194444444444445, 'pattern_counts': {'":': 0, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6429455', 'n_tokens_mistral': 691, 'n_tokens_neox': 677, 'n_words': 157}