<commit_before>"""
Root view for gunclub project
"""

from django.template import RequestContext
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response
from django.utils.translation import ugettext as _
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, HttpResponseForbidden

from member.forms import AddMemberForm


@login_required
def home(request):
    """ A dispatch view based on user authorization"""
    if request.user.is_staff:
        return HttpResponseRedirect(reverse('admin_dashboard'))
    else:
        return HttpResponseRedirect(reverse('user_dashboard'))


@login_required
def user_dashboard(request):
    """ User dashboard """
    title = _('User dashboard')
    return render_to_response(
        'dashboard/user.html',
        context_instance=RequestContext(
            request,
            {'title': title,}
            )
        )


@login_required
def admin_dashboard(request):
    """ Administrator dashboard  """
    title = _('Admin dashboard')
    members = User.objects.all()
    form = AddMemberForm()
    if not request.user.is_staff:
        return HttpResponseForbidden()
    return render_to_response(
        'dashboard/admin.html',
        context_instance=RequestContext(
            request,
            {'title': title,
             'members': members,
             'form': form,}
            )
        )<commit_msg>Fixed the missing members context request<commit_after>"""
Root view for gunclub project
"""

from django.template import RequestContext
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response
from django.utils.translation import ugettext as _
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, HttpResponseForbidden

from member.forms import AddMemberForm


@login_required
def home(request):
    """ A dispatch view based on user authorization"""
    if request.user.is_staff:
        return HttpResponseRedirect(reverse('admin_dashboard'))
    else:
        return HttpResponseRedirect(reverse('user_dashboard'))


@login_required
def user_dashboard(request):
    """ User dashboard """
    title = _('User dashboard')
    members = User.objects.all()
    return render_to_response(
        'dashboard/user.html',
        context_instance=RequestContext(
            request,
            {'title': title,
             'members': members,}
            )
        )


@login_required
def admin_dashboard(request):
    """ Administrator dashboard  """
    title = _('Admin dashboard')
    members = User.objects.all()
    form = AddMemberForm()
    if not request.user.is_staff:
        return HttpResponseForbidden()
    return render_to_response(
        'dashboard/admin.html',
        context_instance=RequestContext(
            request,
            {'title': title,
             'members': members,
             'form': form,}
            )
        )
{'fraction_non_alphanumeric': 0.09046692607003891, 'fraction_numerical': 0.0, 'mean_word_length': 3.0592105263157894, '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': '2729828', 'n_tokens_mistral': 799, 'n_tokens_neox': 792, 'n_words': 209}