<commit_before>from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.views.generic import TemplateView, RedirectView, DetailView
from cosinnus.views.mixins.group import RequireReadMixin
from cosinnus.views.group import GroupDetailView, GroupListView

from skillshare import get_skills_for_owner
from references import get_references_for_receiver



class HomeView(TemplateView):
    template_name = 'home.html'

    def get_context_data(self, **kwargs):
        context = super(HomeView, self).get_context_data(**kwargs)
        context['users'] = User.objects.filter(is_superuser=False)
        return context


class ProfileView(DetailView):
    model = User
    slug_field = 'username'
    template_name = 'profile.html'

    def get_context_data(self, **kwargs):
        context = super(ProfileView, self).get_context_data(**kwargs)
        return_url = reverse('profile', kwargs={'slug': context['object']})
        context['skills'] = get_skills_for_owner(
            self.request, context['object'], return_url)
        context['references'], context['reference_form'] = \
            get_references_for_receiver(self.request, context['object'],
            return_url)
        return context

class GroupIndexView(RequireReadMixin, RedirectView):
    def get_redirect_url(self, *args, **kwargs):
        return reverse('cosinnus:group-detail', kwargs={'group': self.group.slug})
group_index = GroupIndexView.as_view()

class EcobasaGroupDetailView(GroupDetailView):
    def get_context_data(self, **kwargs):
        context = super(EcobasaGroupDetailView, self).get_context_data(**kwargs)
        context['profile'] = self.object.profile
        return context
group_detail = EcobasaGroupDetailView.as_view()

class EcobasaGroupListView(GroupListView):
    def get_context_data(self, **kwargs):
        context = super(EcobasaGroupListView, self).get_context_data(**kwargs)
        return context
group_list = EcobasaGroupListView.as_view()<commit_msg>#19 instanced views<commit_after>from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.views.generic import TemplateView, RedirectView, DetailView
from cosinnus.views.mixins.group import RequireReadMixin
from cosinnus.views.group import GroupDetailView, GroupListView
from cosinnus.views.profile import UserProfileDetailView
from cosinnus.views.user import UserListView

from skillshare import get_skills_for_owner
from references import get_references_for_receiver



class HomeView(TemplateView):
    template_name = 'home.html'

    def get_context_data(self, **kwargs):
        context = super(HomeView, self).get_context_data(**kwargs)
        context['users'] = User.objects.filter(is_superuser=False)
        return context


# class ProfileView(DetailView):
#     model = User
#     slug_field = 'username'
#     template_name = 'profile.html'

#     def get_context_data(self, **kwargs):
#         context = super(ProfileView, self).get_context_data(**kwargs)
#         return_url = reverse('profile', kwargs={'slug': context['object']})
#         context['skills'] = get_skills_for_owner(
#             self.request, context['object'], return_url)
#         context['references'], context['reference_form'] = \
#             get_references_for_receiver(self.request, context['object'],
#             return_url)
#         return context


class EcobasaProfileView(UserProfileDetailView):
    def get_context_data(self, **kwargs):
        context = super(EcobasaProfileView, self).get_context_data(**kwargs)
        context['profile'] = self.object.profile
        return context
user_detail = EcobasaProfileView.as_view()


class EcobasaProfileListView(UserListView):
    def get_context_data(self, **kwargs):
        context = super(EcobasaProfileListView, self).get_context_data(**kwargs)
        return context
user_list = EcobasaProfileListView.as_view()


class GroupIndexView(RequireReadMixin, RedirectView):
    def get_redirect_url(self, *args, **kwargs):
        return reverse('cosinnus:group-detail', kwargs={'group': self.group.slug})
group_index = GroupIndexView.as_view()


class EcobasaGroupDetailView(GroupDetailView):
    def get_context_data(self, **kwargs):
        context = super(EcobasaGroupDetailView, self).get_context_data(**kwargs)
        context['profile'] = self.object.profile
        return context
group_detail = EcobasaGroupDetailView.as_view()


class EcobasaGroupListView(GroupListView):
    def get_context_data(self, **kwargs):
        context = super(EcobasaGroupListView, self).get_context_data(**kwargs)
        return context
group_list = EcobasaGroupListView.as_view()
{'fraction_non_alphanumeric': 0.10374331550802139, 'fraction_numerical': 0.000427807486631016, 'mean_word_length': 4.6201923076923075, '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': '6295572', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1338, 'n_words': 263}