Пример #1
0
def sandbox(request):
	a = file("e:/college/lms_member.csv", 'r') 
	item = a.readline()
	datime = datetime.datetime.now()
	while (item):
		container = item.split();
		stuid = container[len(container)-1]
		lastname = container[len(container)-2]
		
		firstname = ""
		for i in xrange(len(container)-2):
			firstname += container[i] + " "
		
		balance = 100
		emailid = container[0] +stuid+'@ioests.ioe.edu.np'
		
		stuData = Student(student_id = stuid, firstname = firstname, lastname = lastname,
							lastlogin = datime, password = hash(stuid), balance = balance, emailid =emailid )
		stuData.save()

		opeData = getoperator("hari")

		actData = Activity(student=stuData,atype='newaccount',operator=opeData,details='new account created',amount=100.)
		actData.save()
		
		item = a.readline()
	return HttpResponse("sandbox test")
Пример #2
0
def changePassword(userid, password, confirm):
    if password != confirm:
        return False
    
    user = Student.objects.get(student_id = userid)
    user.password = hash(password)
    import datetime
    user.lastlogin = datetime.datetime.now()
    user.save()
    
    return True