<commit_before>from django.contrib import messages
from django.core.urlresolvers import reverse
from django.shortcuts import render, redirect
from django.views.decorators.http import require_http_methods
from django.contrib.auth.decorators import login_required
from myhpom.forms.profile import EditUserForm, EditUserDetailsForm
from myhpom.models.user import User
from datetime import datetime


@require_http_methods(['GET'])
@login_required
def view_profile(request):
    return render(request, 'myhpom/profile/view.html', {'user': request.user})


@require_http_methods(['GET', 'POST'])
@login_required
def edit_profile(request):
    user = User.objects.get(username=request.user.username)
    if request.method == 'POST':
        user_form = EditUserForm(data=request.POST, instance=user)
        user_details_form = EditUserDetailsForm(data=request.POST, instance=user.userdetails)
        if user_form.is_valid():
            user_form.save()<commit_msg>[mh-12] no need to pass user as context since user is available in request automatically<commit_after>from django.contrib import messages
from django.core.urlresolvers import reverse
from django.shortcuts import render, redirect
from django.views.decorators.http import require_http_methods
from django.contrib.auth.decorators import login_required
from myhpom.forms.profile import EditUserForm, EditUserDetailsForm
from myhpom.models.user import User
from datetime import datetime


@require_http_methods(['GET'])
@login_required
def view_profile(request):
    return render(request, 'myhpom/profile/view.html', {})


@require_http_methods(['GET', 'POST'])
@login_required
def edit_profile(request):
    user = User.objects.get(username=request.user.username)
    if request.method == 'POST':
        user_form = EditUserForm(data=request.POST, instance=user)
        user_details_form = EditUserDetailsForm(data=request.POST, instance=user.userdetails)
        if user_form.is_valid():
            user_form.save()
{'fraction_non_alphanumeric': 0.09559939301972686, 'fraction_numerical': 0.0010116337885685382, 'mean_word_length': 5.506578947368421, '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': '1323466', 'n_tokens_mistral': 559, 'n_tokens_neox': 550, 'n_words': 135}