<commit_before>from django.shortcuts import render
from django.template.loader import get_template
from django.http import HttpResponse
from .forms import newMember
from ematrikeln.models import *
from django.shortcuts import redirect


def index(req):
    allMembers = User.objects.all()
    return(render(req,'index.html',{'all':allMembers}))

def add(req,state):
    if state is '':
        success = 'false'
    else:
        success = 'true'
    form = newMember()
    return(render(req,'new.html',{'showdialog':success,'form':form}))

def view_member(req,req_id):
    member =  User.objects.get(id=req_id)
    return(render(req,'medlem.html',{'user':member}))
def delete_member(req,req_id):
    member =  User.objects.get(id= req_id)
    member.delete()
    return redirect('/')
def add_member(req):
    if req.method == 'POST':
        if req.is_valid():
            firstName   = req.POST['firstName']
            lastName    = req.POST['lastName']
            address     = req.POST['address']
            phone       = req.POST['phonenumber']
            city        = req.POST['city']
            postcode    = req.POST['postcode']
            epost       = req.POST['email']<commit_msg>back to modalchoice<commit_after>from django.shortcuts import render
from django.template.loader import get_template
from django.http import HttpResponse
from .forms import newMember
from ematrikeln.models import *
from django.shortcuts import redirect


def index(req):
    allMembers = User.objects.all()
    return(render(req,'index.html',{'all':allMembers}))

def dict2list(list1,list2,list3,other):
    res1 = []
    res2 = []
    res3 = []
    for i in list1:
        print(i)
        res1.append((i['id'],i['name']))
    for i in list2:
        res2.append((i['id'],i['name']))
    for i in list3:
        res3.append((i['id'],i['name']))
    res1.sort()
    res1.append(('-1',other))
    res2.sort()
    res2.append(('-1',other))
    res3.sort()
    res3.append(('-1',other))
    return [res1,res2,res3]

def add(req,state):
    if state is '':
        success = 'false'
    else:
        success = 'true'

    hometownlist    = Town.objects.all()
    schoollist      = School.objects.all()
    gymnasiumlist   = Gymnasium.objects.all()
    herp = dict2list(hometownlist.values(),gymnasiumlist.values(),schoollist.values(),"Annat")
    print(herp)
    form = newMember(*herp)
    return(render(req,'new.html',{'showdialog':success,'form':form}))

def view_member(req,req_id):
    member =  User.objects.get(id=req_id)
    return(render(req,'medlem.html',{'user':member}))
def delete_member(req,req_id):
    member =  User.objects.get(id= req_id)
    member.delete()
    return redirect('/')
def add_member(req):
    if req.method == 'POST':
        if req.is_valid():
            firstName   = req.POST['firstName']
            lastName    = req.POST['lastName']
            address     = req.POST['address']
            phone       = req.POST['phonenumber']
            city        = req.POST['city']
            postcode    = req.POST['postcode']
            epost       = req.POST['email']
{'fraction_non_alphanumeric': 0.15074241446094255, 'fraction_numerical': 0.008392511297611363, 'mean_word_length': 2.8353960396039604, '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': '5976986', 'n_tokens_mistral': 1004, 'n_tokens_neox': 991, 'n_words': 189}