Exemplo n.º 1
0
def exams(request):
    user = getk(request)
    if (user == None):
        user = 0

    #del request.session['user']
    stud = student.objects.get(roll_number__exact=user)
    studs = student.objects.filter(roll_number=11911073).values(
        'Subject_1', 'Subject_1_marks')
    stud_subj = {
        "subject_1": stud.Subject_1,
        "subject_2": stud.Subject_2,
        "subject_3": stud.Subject_3,
        "subject_4": stud.Subject_4,
        "subject_5": stud.Subject_5
    }
    stud_marks = {
        "subject_1_marks": stud.Subject_1_marks,
        "subject_2_marks": stud.Subject_2_marks,
        "subject_3_marks": stud.Subject_3_marks,
        "subject_4_marks": stud.Subject_4_marks,
        "subject_5_marks": stud.Subject_5_marks
    }
    return render(request, 'exams_marks.html', {
        'student': stud,
        'stud_subj': stud_subj,
        'stud_marks': stud_marks
    })
Exemplo n.º 2
0
def lost_items(request):
    if request.method == 'POST':
        itm = item()
        itm.item_name = request.POST.get('item_name')
        itm.desc = request.POST.get('desc')
        itm.found_date = request.POST.get('found_date')
        itm.item_pic = request.POST.get('item_pic')
        itm.save()
        items = item.objects.all()
        user = getk(request)
        if user is not None:
            return render(request, 'lost_items_section.html', {'items': items})
        else:
            return render(request, 'log2home.html')

    else:
        items = item.objects.all()
        user = getk(request)
        if user is not None:
            return render(request, 'lost_items_section.html', {'items': items})
        else:
            return render(request, 'log2home.html')
Exemplo n.º 3
0
def notes(request):
    allProds = []
    catprods = NoteSubject.objects.values('notes_subject', 'id')
    cats = {item['notes_subject'] for item in catprods}
    for cat in cats:
        prod = NoteSubject.objects.filter(notes_subject=cat)
        n = len(prod)
        allProds.append([prod, range(1, n)])
    params = {'allProds':allProds}
    user=getk(request)
    if user is not None:
        return render(request, 'notes/notes.html',params)
    else:
        return render(request,'log2home.html')    
Exemplo n.º 4
0
def club(request):
    allProds = []
    catprods = Group.objects.values('category', 'id')
    cats = {item['category'] for item in catprods}
    for cat in cats:
        prod = Group.objects.filter(category=cat)
        n = len(prod)
        nSlides = n // 4 + ceil((n / 4) - (n // 4))
        allProds.append([prod, range(1, nSlides)])
    params = {'allProds': allProds}
    user = getk(request)
    if user is not None:
        return render(request, 'club/clubs.html', params)
    else:
        return render(request, 'log2home.html')
Exemplo n.º 5
0
def cne(request):
    thank = False
    if request.method == "POST":
        name = request.POST.get('name', '')
        querytype = request.POST.get('querytype', '')
        query_status = request.POST.get('query_status', '')
        querysub = request.POST.get('querysub', '')
        branchyear = request.POST.get('branchyear', '')
        querydesc = request.POST.get('querydesc', '')
        email = request.POST.get('email', '')
        rollnumber = getk(request)
        phone = request.POST.get('phone', '')
        complain = Contactcomplain(name=name,
                                   email=email,
                                   rollnumber=rollnumber,
                                   branchyear=branchyear,
                                   phone=phone,
                                   querytype=querytype,
                                   querydesc=querydesc,
                                   query_status="Pending",
                                   querysub=querysub)
        if complain.querytype == "COMPLAIN":
            thank = True
            complain.save()

        enquiry = Contactenquiry(name=name,
                                 email=email,
                                 rollnumber=rollnumber,
                                 branchyear=branchyear,
                                 phone=phone,
                                 querytype=querytype,
                                 querydesc=querydesc,
                                 query_status="Pending",
                                 querysub=querysub)
        if querytype == "ENQUIRY":
            thank = True
            enquiry.save()

    return render(request, 'cne.html', {'thank': thank})