<commit_before># Create your views here.
#-*- coding: utf-8 -*-

from django.http import Http404
from django.shortcuts import render_to_response
from django.contrib.auth import authenticate, login
from django.shortcuts import render
from django.http import HttpResponse
from django.contrib import auth
from django.http import HttpResponseRedirect
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.sessions.backends.db import SessionStore
from models import *
from forms import *
from django.template import *
from django.db.models import Sum
from django.views.defaults import page_not_found as default_page_not_found
from django.views.defaults import server_error as default_server_error 
import operator
from django.contrib.auth.decorators import login_required
import calendar

def accueil(request):
    return render(request, 'accueil.html')

def apropos(request):
    return render(request, 'apropos.html')

def reglement(request):
    return render(request, 'reglement.html')

def challs(request):
    challs_dic={}
    categories = Categorie.objects.all()
    form = None
    
    for categorie in categories:
        challs_dic[categorie]=[]
    challs = Challenge.objects.all()
    for chall in challs:
        try:
            validated = Validation.objects.get(chall=chall, user=request.user)
        except Validation.DoesNotExist:
            form = ValidationForm(idChall=chall.id)
        challs_dic[chall.categorie].append((chall, form))

    return render(request, 'challs.html',{'challs_dic':challs_dic})

@login_required
def view_chall(request, challID):
    chall = None
    validated = None
    form = None
    try:<commit_msg>Do not show private challenge<commit_after># Create your views here.
#-*- coding: utf-8 -*-

from django.http import Http404
from django.shortcuts import render_to_response
from django.contrib.auth import authenticate, login
from django.shortcuts import render
from django.http import HttpResponse
from django.contrib import auth
from django.http import HttpResponseRedirect
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.sessions.backends.db import SessionStore
from models import *
from forms import *
from django.template import *
from django.db.models import Sum
from django.views.defaults import page_not_found as default_page_not_found
from django.views.defaults import server_error as default_server_error 
import operator
from django.contrib.auth.decorators import login_required
import calendar

def accueil(request):
    return render(request, 'accueil.html')

def apropos(request):
    return render(request, 'apropos.html')

def reglement(request):
    return render(request, 'reglement.html')

def challs(request):
    challs_dic={}
    categories = Categorie.objects.all()
    form = None
    
    for categorie in categories:
        challs_dic[categorie]=[]
    challs = Challenge.objects.filter(private=False)
    for chall in challs:
        try:
            validated = Validation.objects.get(chall=chall, user=request.user)
        except Validation.DoesNotExist:
            form = ValidationForm(idChall=chall.id)
        challs_dic[chall.categorie].append((chall, form))

    return render(request, 'challs.html',{'challs_dic':challs_dic})

@login_required
def view_chall(request, challID):
    chall = None
    validated = None
    form = None
    try:
{'fraction_non_alphanumeric': 0.08260361938120257, 'fraction_numerical': 0.002335084646818447, 'mean_word_length': 4.296754250386399, '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': '303679', 'n_tokens_mistral': 1005, 'n_tokens_neox': 988, 'n_words': 279}