<commit_before>#!/usr/bin/env python
#coding:utf-8

from django.http import Http404,HttpResponseRedirect
from app.models import FikanoteDB, AgendaDB, Shownote
from shownoteform import ShownoteForm
from agendaform import AgendaForm
from django.shortcuts import render
import datetime

def shownote(request):
    if request.method == 'GET': 
        agendas = AgendaDB.objects().order_by('-date')
        return render(request, 'edit_shownote.html', 
                      {'agendas': agendas 
                       , 'agendaform': AgendaForm()
                       , 'shownoteform': ShownoteForm() 
                       } )

    elif request.method == 'POST': 
        form = ShownoteForm(request.POST) 
        if form.is_valid(): 
            number = FikanoteDB.objects().count()+1
            # add to shownote
            shownotes = []
            list_title = request.POST.getlist('agenda_title')
            list_url = request.POST.getlist('agenda_url')
            list_id = request.POST.getlist('agenda_id')
            for i in range(len(list_title)):
                shownotes.append(Shownote(title=list_title[i], url=list_url[i]))
            FikanoteDB(number = number
                       , title=form.cleaned_data['title']
                       , person=form.cleaned_data['person'].split(",")
                       , agenda=form.cleaned_data['agenda']
                       , date=datetime.datetime.utcnow()
                       , shownotes=shownotes
                       ).save()
            # delete id's item from agendadb
            for i in range(len(list_id)):
                AgendaDB.objects.filter(id__exact=list_id[i]).delete()

        return HttpResponseRedirect('/') 
        
    else:
        raise Http404<commit_msg>modify spaces.<commit_after>#!/usr/bin/env python
#coding:utf-8

from django.http import Http404,HttpResponseRedirect
from app.models import FikanoteDB, AgendaDB, Shownote
from shownoteform import ShownoteForm
from agendaform import AgendaForm
from django.shortcuts import render
import datetime

def shownote(request):
    if request.method == 'GET':
        agendas = AgendaDB.objects().order_by('-date')
        return render(request, 'edit_shownote.html',
                      {'agendas': agendas
                       , 'agendaform': AgendaForm()
                       , 'shownoteform': ShownoteForm()
                       } )

    elif request.method == 'POST':
        form = ShownoteForm(request.POST)
        if form.is_valid():
            number = FikanoteDB.objects().count()+1
            # add to shownote
            shownotes = []
            list_title = request.POST.getlist('agenda_title')
            list_url = request.POST.getlist('agenda_url')
            list_id = request.POST.getlist('agenda_id')
            for i in range(len(list_title)):
                shownotes.append(Shownote(title=list_title[i], url=list_url[i]))
            FikanoteDB(number = number
                       , title=form.cleaned_data['title']
                       , person=form.cleaned_data['person'].split(",")
                       , agenda=form.cleaned_data['agenda']
                       , date=datetime.datetime.utcnow()
                       , shownotes=shownotes
                       ).save()
            # delete id's item from agendadb
            for i in range(len(list_id)):
                AgendaDB.objects.filter(id__exact=list_id[i]).delete()

        return HttpResponseRedirect('/')

    else:
        raise Http404
{'fraction_non_alphanumeric': 0.10737681572201652, 'fraction_numerical': 0.004557106237539163, 'mean_word_length': 1.9145228215767636, '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': '7411835', 'n_tokens_mistral': 1014, 'n_tokens_neox': 948, 'n_words': 182}