<commit_before>from django.http import HttpResponseForbidden
from django.http import HttpResponseNotFound
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
from django.core import serializers
from django.db.utils import IntegrityError
from django.db import transaction
from django.utils import simplejson as json
from geonition_utils.HttpResponseExtenders import HttpResponseNotImplemented
from geonition_utils.HttpResponseExtenders import HttpResponseCreated
from geonition_utils.HttpResponseExtenders import HttpResponseConflict
from geonition_utils.HttpResponseExtenders import HttpResponseUnauthorized
from geonition_utils.views import RequestHandler
from models import Relationship
    
class People(RequestHandler):
    
    def __init__(self):
        pass
    
    def get(self, request, *args, **kwargs):
        
        #get the values
        user = kwargs.get('user', None)
        group = kwargs.get('group', None)
                    
        if user == '@me' and request.user.is_authenticated():
            person_object = request.user
            
        elif request.user.is_authenticated():
            person_object = User.objects.get(username=user)
            
        else:
            return HttpResponseForbidden("You need to sign in to make requests")
        
        
        
        
    
def people(request, **kwargs):
        
        
    if request.method == 'POST':
        
        if request.user.is_authenticated():
            initial_user = user
            relationship_type = group
                
            return create_relationship(request, initial_user, relationship_type)
        else:
            return HttpResponseUnauthorized("The user needs to be authenticated to make this request")
        
    return people_not_implemented()


def create_relationship(request, initial_user, relationship_type):<commit_msg>the views modified so that also POST is inside the view class<commit_after>from django.http import HttpResponseForbidden
from django.http import HttpResponseNotFound
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
from django.core import serializers
from django.db.utils import IntegrityError
from django.db import transaction
from django.utils import simplejson as json
from geonition_utils.HttpResponseExtenders import HttpResponseNotImplemented
from geonition_utils.HttpResponseExtenders import HttpResponseCreated
from geonition_utils.HttpResponseExtenders import HttpResponseConflict
from geonition_utils.HttpResponseExtenders import HttpResponseUnauthorized
from geonition_utils.views import RequestHandler
from models import Relationship
    
class People(RequestHandler):
    
    def __init__(self):
        pass
    
    def get(self, request, *args, **kwargs):
        
        #get the values
        user = kwargs.get('user', None)
        group = kwargs.get('group', None)
                    
        if user == '@me' and request.user.is_authenticated():
            person_object = request.user
            
        elif request.user.is_authenticated():
            person_object = User.objects.get(username=user)
            
        else:
            return HttpResponseForbidden("You need to sign in to make requests")
        
        return HttpResponseNotImplemented("no not yet!")
        
    def post(self):
        if request.user.is_authenticated():
            initial_user = user
            relationship_type = group
                
            return create_relationship(request, initial_user, relationship_type)
        else:
            return HttpResponseUnauthorized("The user needs to be authenticated to make this request")
        

def create_relationship(request, initial_user, relationship_type):
{'fraction_non_alphanumeric': 0.05866807610993657, 'fraction_numerical': 0.0, 'mean_word_length': 2.8741044012282497, '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': '3365353', 'n_tokens_mistral': 920, 'n_tokens_neox': 907, 'n_words': 272}