<commit_before>"""Simple views for users info."""

import logging

from braces.views import LoginRequiredMixin

from django.urls import reverse_lazy
from django.views.generic.edit import FormView

from .forms import ProfileForm

logger = logging.getLogger(__name__)


class UserProfileView(LoginRequiredMixin, FormView):
    """Show current user profile."""

    template_name = "users/profile.html"
    form_class = ProfileForm
    success_url = reverse_lazy('userjob-list')

    def get_context_data(self, **kwargs):
        """Add user to kwargs."""
        kwargs = super(UserProfileView, self).get_context_data(**kwargs)
        kwargs['user'] = self.request.user
        return kwargs

    def get_form_kwargs(self):
        """Add user to kwargs."""
        kwargs = super(UserProfileView, self).get_form_kwargs()
        kwargs['user'] = self.request.user
        return kwargs<commit_msg>save results<commit_after>"""Simple views for users info."""

import logging

from braces.views import LoginRequiredMixin

from django.contrib import messages
from django.urls import reverse_lazy
from django.views.generic.edit import FormView

from .forms import ProfileForm

logger = logging.getLogger(__name__)


class UserProfileView(LoginRequiredMixin, FormView):
    """Show current user profile."""

    template_name = "users/profile.html"
    form_class = ProfileForm
    success_url = reverse_lazy('userjob-list')

    def get_context_data(self, **kwargs):
        """Add user to kwargs."""
        kwargs = super(UserProfileView, self).get_context_data(**kwargs)
        kwargs['user'] = self.request.user
        return kwargs

    def get_form_kwargs(self):
        """Add user to kwargs."""
        kwargs = super(UserProfileView, self).get_form_kwargs()
        kwargs['user'] = self.request.user
        return kwargs

    def form_valid(self, form):
        """Save form and return."""
        form.save()
        messages.success(self.request, "Profile changes saved.")
        return super(UserProfileView, self).form_valid(form)
{'fraction_non_alphanumeric': 0.10812133072407044, 'fraction_numerical': 0.0, 'mean_word_length': 3.595505617977528, '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': '4714300', 'n_tokens_mistral': 565, 'n_tokens_neox': 563, 'n_words': 149}