Exemplo n.º 1
0
def saveCV(request):
    username = request.session
    gests = dbUsers()
    idprof = gests.returnOne(username['idsession'])
    if 'idsession' not in request.session:
        return redirect("/")
    now = datetime.datetime.now()
    nom = request.GET['nom']
    prenom = request.GET['prenom']
    sexe = request.GET['sexe']
    cin = request.GET['cin']
    telephone = request.GET['telephone']
    email = request.GET['email']
    formation = request.GET['formation']
    etude = request.GET['etude']
    experience = request.GET['experience']
    langue = request.GET['langue']
    reference = request.GET['reference']

    etab = dbProfesseur()
    idprof = etab.returnOne(idprof)
    ecole = CVprof(idprof=idprof,nom=nom,prenom=prenom,cin=cin,sexe=sexe,telephone=telephone,email=email,formation=formation,etude=etude,experience=experience,langue=langue,reference=reference,date=now)

    if(not etab.isCVExist(idprof=idprof,nom=nom,prenom=prenom,cin=cin,sexe=sexe,telephone=telephone,email=email,formation=formation,etude=etude,experience=experience,langue=langue,reference=reference)):
        if(not etab.saveCV(ecole)):
            message = "CV ajouter !"
        else:
            message = "CV non ajouter."
    else:
        message = "le CV du professeur {} {} existe deja.".format(prenom,nom)
    return render(request, 'prof/saveCV.html',{'etab':ecole,'message': message,'username':username['idsession']})
Exemplo n.º 2
0
def addcv(request):
    username = request.session
    gests = dbUsers()
    idprof = gests.returnOne(username['idsession'])
    if 'idsession' not in request.session:
        return redirect("/")
    gest = dbProfesseur()
    prof = gest.returnOne(idprof.id)
    cv = gest.returnCV(idprof.id)
    return render(request,'prof/ajouterCV.html',{'etab':prof,'cv':cv,'username':username['idsession']})
Exemplo n.º 3
0
def viewCV(request):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    gest = dbProfesseur()
    gests = dbUsers()
    idprof = gests.returnOne(username['idsession'])
    prof = gest.returnOne(idprof.id)
    cv = gest.returnCV(idprof.id)
    if(not cv==None):
        message = ""
        find = True
    else:
        message = "Vous n'avez pas encore enregistrer votre CV. "
        find = False
    return render(request,'prof/cv.html',{'cv':cv, 'prof':prof,'message':message,'find':find,'username':username['idsession']})
Exemplo n.º 4
0
def cours(request):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    gest = dbCours()
    schools = gest.returnAll()
    cours = []
    courProf = []
    gests = dbUsers()
    idprof = gests.returnOne(username['idsession'])
    for list in schools:
        if idprof.id == list.professeur.id:
            courProf.append(list)
    try:
        id = request.POST['cours']
        cours = gest.returnOne(id)
    except:
        pass
    return render(request, 'prof/listerCours.html', {'school': courProf,'ecole':cours,'username':username['idsession']})
Exemplo n.º 5
0
def login(request):
    users = dbUsers()
    user=users.returnAll()
    message = ''
    if 'username' in request.POST:
        for t in user :
            if request.POST['username'].__eq__(t.username) and request.POST['password'].__eq__(t.password):
               request.session['idsession'] = request.POST['username']
               request.session['type'] = t.type
               if t.type == "Administrateur":
                   return redirect("/admin/")
               else:
                   return redirect("/professeur/")
            else:
                message = "Access denied"
        if 'idsession' in request.session:
            return redirect("/admin/")
    else:
        if 'idsession' in request.session:
            return redirect("/admin/")
    return render(request, 'login/login.html',{'message':message})
Exemplo n.º 6
0
def sauvegarder(request):
    user = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    now = datetime.datetime.now()
    users = dbUsers()
    gest = dbProfesseur()
    idprof = request.POST['idprof']
    username = request.POST['username']
    password = request.POST['password']
    type = request.POST['type']

    utilisateur = Users(professeur=gest.returnOne(idprof),username=username,password=password,type=type,date=now)

    if(not users.isExist(username=username)):
        if(not users.save(utilisateur)):
            message = "Le compte a ete cree !"
        else:
            message = "Compte non cree."
    else:
        message = "le compte {} existe deja.".format(username)

    return render(request, 'index/create.html',{'message':message,'username':user['idsession']})