def ExtraAcademicInfoDetailsIndex(HttpRequest):
    ip = HttpRequest.META['REMOTE_ADDR']
    logindetails = GetLoginDetails(HttpRequest)
    print logindetails
    try:
      
      if( logindetails["userid"] == -1):
          messages.error(HttpRequest,'Please Login to continue')
          return HttpResponseRedirect('/user/login/')
      yearlist=range(1985,2014);
      if 'v' in HttpRequest.GET:
        if is_integer(HttpRequest.GET['v']):
          _id=int(HttpRequest.GET['v'])
          try:
            obj=ExtraAcademicInfoDetails.objects.get(User=logindetails["userid"],id=_id)
            return render_to_response("UserProfile/ExtraAcademicInfoDetails.html",{'yearlist':yearlist,'ExtraAcadStatus':obj},context_instance=RequestContext(HttpRequest))
          except ObjectDoesNotExist:
            return render_to_response("UserProfile/ExtraAcademicInfoDetails.html",{'yearlist':yearlist,},context_instance=RequestContext(HttpRequest))
          
      
      else:
        return render_to_response("UserProfile/ExtraAcademicInfoDetails.html",{'yearlist':yearlist,},context_instance=RequestContext(HttpRequest))
    except Exception, ex:
      frame = inspect.currentframe()
      args, _, _, values = inspect.getargvalues(frame)
      msg = ''
      for i in args:
        msg += "[%s : %s]" % (i,values[i])
      Logger_User.exception('%s : %s' % (inspect.getframeinfo(frame)[2],msg))
      messages.error(HttpRequest,'ERROR: ' + str(ex))
      return HttpResponseRedirect('/message/')
Exemple #2
0
 def getSearchControls(self,ControlInfo,data):
   searchControls=''
   arr=ControlInfo.split(",")
   count=0
   for a in arr:
     for obj in self.myoptions:
       if is_integer(a)and int(a)==obj.Id:
         count=count+1
         searchControls+=obj.gethtmlControl(count,data)
         break
   return searchControls
Exemple #3
0
 def getSearchResults(self,ControlInfo,data):
   sqlstatement=None
   arr=ControlInfo.split(",")
   count=0
   for a in arr:
     for obj in self.myoptions:
       if is_integer(a)and int(a)==obj.Id:
         count=count+1
         sqlstatement=obj.getsqlstatement(count,data,sqlstatement)
         break
   if count==0:
     sqlstatement='Select * from "View_Student" order by "BranchMajor" ,"FirstName";'
   else:
     sqlstatement='Select * from "View_Student" where "Id" in (%s)'%(sqlstatement)+' order by "BranchMajor","FirstName" ;'
   try:
       datareturned=DBhelper.CallSelectFunction(sqlstatement)
   except Exception, ex:
       datareturned=None
def ExtraAcademicInfoDetailsDelete(HttpRequest):
    ip = HttpRequest.META['REMOTE_ADDR']
    logindetails = GetLoginDetails(HttpRequest)
    print logindetails
    try:
      
      if( logindetails["userid"] == -1):
          messages.error(HttpRequest,'Please Login to continue')
          return HttpResponseRedirect('/user/login/')
      if 'v' in HttpRequest.GET:
        if is_integer(HttpRequest.GET['v']):
          _id=int(HttpRequest.GET['v'])
          try:
            obj=ExtraAcademicInfoDetails.objects.get(User=logindetails["userid"],id=_id)
            ExtraAcademicInfoObj=ExtraAcademicInfo()
            result=ExtraAcademicInfoObj.DeleteExtraAcademicInfoDetails(_id,logindetails["userid"],logindetails["userid"], ip)
            if(result['result']==1):
              messages.info(HttpRequest,"Congrats Your details have been saved");
            elif(result['result']==2):
              messages.info(HttpRequest,"Does NOt Exist");
            elif(result['result']==-2):
              messages.error(HttpRequest,"You do not have the required privelege to this particular page.Either you do not have authenticated yourself or You have not completed your previous details ");
            else:
              messages.error(HttpRequest,"result is %s"%result);
              return HttpResponseRedirect('/message/')
            return HttpResponseRedirect('/message/')
          except ObjectDoesNotExist:
            messages.error(HttpRequest,"Does NOt Exist");
            return HttpResponseRedirect('/message/')
      
      else:
        messages.info(HttpRequest,"Does NOt Exist");
    except Exception, ex:
      frame = inspect.currentframe()
      args, _, _, values = inspect.getargvalues(frame)
      msg = ''
      for i in args:
        msg += "[%s : %s]" % (i,values[i])
      Logger_User.exception('%s : %s' % (inspect.getframeinfo(frame)[2],msg))
      messages.error(HttpRequest,'ERROR: ' + str(ex))
      return HttpResponseRedirect('/message/')
Exemple #5
0
 def getsqlstatement(self,count,data,sqlstatement):
   name='Control%s'%(count)
   nameor='ControlOr%s'%(count)
   value='0'
   nameoper='ControlOper%s'%(count)
   oper='='
   if nameoper in data:
     
     oper=data[nameoper]
   
   if name in data:
     if is_integer(data[name]):
       value=data[name]
   if sqlstatement==None:
     sqlstatement='Select "Id" from "View_Student" where'
   else :
     sqlstatement='Select "Id" from "View_Student" where "Id" in (%s)'%(sqlstatement)
     if nameor in data:
       sqlstatement=sqlstatement+' or '
     else:
       sqlstatement=sqlstatement+' and '
   sqlstatement=sqlstatement+' cast("Age" as integer) %s %s'%(oper,value)
   return sqlstatement
def MarksPostSave(HttpRequest):
    msglist = AppendMessageList(HttpRequest)
    ip = HttpRequest.META['REMOTE_ADDR']
    logindetails = GetLoginDetails(HttpRequest)
    print logindetails
    if( logindetails["userid"] == -1):
        messages.error(HttpRequest,'ERROR : Please Login to continue')
        HttpRequest.session[SESSION_MESSAGE] = msglist
        return HttpResponseRedirect('/user/login/')
    try:
        MarksObj=Marks()
        flag=1
        if "SessionStartMonth" in HttpRequest.POST:
            SessionStartMonth=HttpRequest.POST["SessionStartMonth"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for SessionStartMonth')
            msglist.append("Error fetching data from form for SessionStartMonth");
            flag=-1;
        if "SessionStartYear" in HttpRequest.POST:
            SessionStartYear=HttpRequest.POST["SessionStartYear"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for SessionStartYear')
            flag=-1;
        if(flag!=-1):
          SessionStart="1 "+SessionStartMonth+" "+SessionStartYear; 
        if "SessionEndMonth" in HttpRequest.POST:
            SessionEndMonth=HttpRequest.POST["SessionEndMonth"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for SessionEndMonth')
            msglist.append("Error fetching data from form for SessionEndMonth");
            flag=-1;
        if "SessionEndYear" in HttpRequest.POST:
            SessionEndYear=HttpRequest.POST["SessionEndYear"]
        else:
          messages.error(HttpRequest,'ERROR : Error fetching data from form for SessionEndYear')
          msglist.append("Error fetching data from form for SessionEndYear");
          flag=-1;
        if(flag!=-1):
          SessionEnd="1 "+SessionEndMonth+" "+SessionEndYear;
        if "SessionNumber" in HttpRequest.session:
            _SessionNumber=HttpRequest.session["SessionNumber"]
        else:
          messages.error(HttpRequest,'ERROR : Error fetching data from form for SessionNumber')
          msglist.append("Error fetching data from form for SessionNumber");
          flag=-1;
        if "SessionType" in HttpRequest.session:
            SessionType=HttpRequest.session["SessionType"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for SessionType')
            msglist.append("Error fetching data from form for SessionType");
            flag=-1;
        if "TotalMarks" in HttpRequest.POST:
            TotaMarks=HttpRequest.POST["TotalMarks"]
            if is_integer(TotaMarks):
              TotaMarks=int(TotaMarks)
            else:
              messages.error(HttpRequest,'ERROR : TotaMarks should be a number')
              msglist.append("TotaMarks should be a number");
              flag=-1;
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for TotaMarks')
              
            msglist.append("Error fetching data from form for TotaMarks");
            flag=-1;
        if "SecuredMarks" in HttpRequest.POST:
            SecuredMarks=HttpRequest.POST["SecuredMarks"]
            if is_integer(SecuredMarks):
              SecuredMarks=int(SecuredMarks)
            else:
              messages.error(HttpRequest,'ERROR : SecuredMarks should be a number')
              msglist.append("SecuredMarks should be a number");
              flag=-1;
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for SecuredMarks')
            msglist.append("Error fetching data from form for SecuredMarks");
            flag=-1;
        if "TotalReapears" in HttpRequest.POST:
            TotalReappears=HttpRequest.POST["TotalReapears"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for TotalReappears')
            msglist.append("Error fetching data from form for TotalReappears");
            flag=-1;
        if "RepearsRemaining" in HttpRequest.POST:
            ReappearsRemaining=HttpRequest.POST["RepearsRemaining"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for ReappearsRemaining')
            msglist.append("Error fetching data from form for RepearsRemaining");
            flag=-1;
        if "DegreeType" in HttpRequest.session:
            DegreeType=HttpRequest.session["DegreeType"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for DegreeType')
            msglist.append("Error fetching data from form for DegreeType");
            flag=-1;
        if "Board" in HttpRequest.POST:
            Boardid=HttpRequest.POST["Board"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for Board')
            msglist.append("Error fetching data from form for Board");
            flag=-1;
        if "Degree" in HttpRequest.session:
            _Degree=HttpRequest.session["Degree"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for Degree')
            msglist.append("Error fetching data from form for Degree");
            flag=-1;
        Boardobj=Board.objects.all();
        yearlist=range(1985,2014);
        relist=range(0,20);
        if flag==-1:
            HttpRequest.session[SESSION_MESSAGE] = msglist
            return render_to_response("UserProfile/MarksSave.html",{'BoardObject':Boardobj,'yearlist':yearlist,'relist':relist},context_instance=RequestContext(HttpRequest))
        if(modelMarks.objects.filter(SessionNumber=_SessionNumber,Degree=_Degree,UserId=logindetails["userid"]).count()==0):
          result=MarksObj.InsertMarks(SessionStart, SessionEnd, _SessionNumber, SessionType, TotaMarks, SecuredMarks, TotalReappears, ReappearsRemaining, DegreeType, Boardid, _Degree, logindetails["userid"],logindetails["userid"], ip)
        else:
          _id=modelMarks.objects.get(SessionNumber=_SessionNumber,Degree=_Degree,UserId=logindetails["userid"]).id;
          result=MarksObj.UpdateMarks(_id,SessionStart, SessionEnd, _SessionNumber, SessionType, TotaMarks, SecuredMarks, TotalReappears, ReappearsRemaining, DegreeType, Boardid, _Degree, logindetails["userid"],logindetails["userid"], ip)
        
        msglist.append("result is %s"%result);
        if(result['result']==1):
          messages.info(HttpRequest,"SUCCESS")
        else:
          messages.info(HttpRequest,"Error Occured please try again")
        return render_to_response("UserProfile/MarksSave.html",{'BoardObject':Boardobj,'yearlist':yearlist,'relist':relist},context_instance=RequestContext(HttpRequest))
    except Exception as inst:
        print type(inst)     # the exception instance
        print inst.args      # arguments stored in .args
        print inst           # __str__ allows args to printed directly
        x, y = inst.args
        print 'x =', x
        print 'y =', y
Exemple #7
0
def StudentDetailsUpdate(HttpRequest):
        ip = HttpRequest.META['REMOTE_ADDR']
        logindetails = GetLoginDetails(HttpRequest)
        if( logindetails["userid"] == -1):
            messages.error(HttpRequest,'Please Login to continue')
            return HttpResponseRedirect('/user/login/')
        try:
            
            flag=1
            UserId=int(logindetails["userid"])
            RollNo = -1
            BranchMajor = -1
            BranchMinor = -1
            Degree = -1
            Category = -1
            ComputerProficiency = ""
            aieee = 'null'
            if "Id" in HttpRequest.POST:
                Id=HttpRequest.POST["Id"]
                if len(Id) == 0:
                      messages.error(HttpRequest,"Id is required");
                      flag=-1;
            else:
                messages.error(HttpRequest,"Error fetching data from form for Id");
                flag=-1;
            if "AIEEERank" in HttpRequest.POST:
                aieee= HttpRequest.POST["AIEEERank"]
                if is_integer(aieee):
                  aieee=int(aieee)
                else:
                  messages.error(HttpRequest,"Error AIEEE Rank should be number only");
                  flag=-1;
            else:
                messages.error(HttpRequest,"Error fetching data from form for aieee");
                flag=-1;
            
            if "RollNo" in HttpRequest.POST:
                RollNo=HttpRequest.POST["RollNo"]
                if len(RollNo) == 0:
                      messages.error(HttpRequest,"RollNo is required");
                      flag=-1;
            else:
                messages.error(HttpRequest,"Error fetching data from form for RollNo");
                flag=-1;
            
            if "BranchMajor" in HttpRequest.POST:
                BranchMajor= int(HttpRequest.POST["BranchMajor"])
                if BranchMajor == -1:
                    messages.error(HttpRequest,"Please select value for BranchMajor");
                    flag=-1;
            else:
                messages.error(HttpRequest,"Error fetching data from form for BranchMajor");
                flag=-1;
            
            if "BranchMinor" in HttpRequest.POST:
                BranchMinor= int(HttpRequest.POST["BranchMinor"])
            else:
                messages.error(HttpRequest,"Error fetching data from form for BranchMinor");
                flag=-1;                    
            
            if "Degree" in HttpRequest.POST:
                Degree=int(HttpRequest.POST["Degree"])
                if Degree == -1:
                    messages.error(HttpRequest,"Please select value for Degree");
                    flag=-1;
            else:
                messages.error(HttpRequest,"Error fetching data from form for Degree");
                flag=-1;
            
            if "Category" in HttpRequest.POST:
                Category=int(HttpRequest.POST["Category"])
                if Category == -1:
                    messages.error(HttpRequest,"Please select value for Category");
                    flag=-1;
            else:
                messages.error(HttpRequest,"Error fetching data from form for Category");
                flag=-1;
            
            if "ComputerProficiency" in HttpRequest.POST:
                ComputerProficiency=HttpRequest.POST["ComputerProficiency"]
            else:
                ComputerProficiency = "Not applicable"  
            if flag==-1:
                return HttpResponseRedirect('/message/')
            else:
                UserProfileObj=UserProfile()
                BranchObj = Branch.objects.get(id=BranchMajor)
                Group = "GROUP_"  + BranchObj.BranchName  + "_UN-AUTHENTICATED"
                result=UserProfileObj.UpdateStudentDetails(Id,UserId, RollNo, BranchMajor, BranchMinor, Degree, Category, ComputerProficiency,aieee,UserId, ip,Group)
                messages.error(HttpRequest,result[1])
                return HttpResponseRedirect('/message/')
        except Exception, ex:
            frame = inspect.currentframe()
            args, _, _, values = inspect.getargvalues(frame)
            msg = ''
            for i in args:
              msg += "[%s : %s]" % (i,values[i])
            LogUser.exception('%s : %s' % (inspect.getframeinfo(frame)[2],msg))
            messages.error(HttpRequest,'ERROR: ' + str(ex))
            return HttpResponseRedirect('/message/')
Exemple #8
0
def MarksPostSave(HttpRequest):
    logindetails = GetLoginDetails(HttpRequest)
    ip = HttpRequest.META['REMOTE_ADDR']
    if( logindetails["userid"] == -1):
        messages.error(HttpRequest,'ERROR : Please Login to continue')
        return HttpResponseRedirect('/user/login/')
    try:
        MarksObj=Marks()
        flag=1
        if "SessionStartMonth" in HttpRequest.POST:
            SessionStartMonth=HttpRequest.POST["SessionStartMonth"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for SessionStartMonth')
            flag=-1;
        if "SessionStartYear" in HttpRequest.POST:
            SessionStartYear=HttpRequest.POST["SessionStartYear"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for SessionStartYear')
            flag=-1;
        if(flag!=-1):
          SessionStart= "1 "+SessionStartMonth+" "+SessionStartYear; 
        if "SessionEndMonth" in HttpRequest.POST:
            SessionEndMonth=HttpRequest.POST["SessionEndMonth"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for SessionEndMonth')
            flag=-1;
        if "SessionEndYear" in HttpRequest.POST:
            SessionEndYear=HttpRequest.POST["SessionEndYear"]
        else:
          messages.error(HttpRequest,'ERROR : Error fetching data from form for SessionEndYear')
          flag=-1;
        if(flag!=-1):
          SessionEnd="1 "+SessionEndMonth+" "+SessionEndYear;
        if "SessionNumber" in HttpRequest.session:
            _SessionNumber=HttpRequest.session["SessionNumber"]
            del HttpRequest.session['SessionNumber']
        else:
          messages.error(HttpRequest,'ERROR : Please Choose a Session First')
          flag=-2;
        if "SessionType" in HttpRequest.session:
            SessionType=HttpRequest.session["SessionType"]
            del HttpRequest.session["SessionType"]
        else:
            messages.error(HttpRequest,'ERROR : Please Choose a Session First')
            flag=-2;
        if "TotalMarks" in HttpRequest.POST:
            TotaMarks=HttpRequest.POST["TotalMarks"]
            if is_integer(TotaMarks):
              TotaMarks=int(TotaMarks)
            else:
              messages.error(HttpRequest,'ERROR : TotaMarks should be a number')
              flag=-1;
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for TotaMarks')
            flag=-1;
        if "SecuredMarks" in HttpRequest.POST:
            SecuredMarks=HttpRequest.POST["SecuredMarks"]
            if is_integer(SecuredMarks):
              SecuredMarks=int(SecuredMarks)
            else:
              messages.error(HttpRequest,'ERROR : SecuredMarks should be a number')
              flag=-1;
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for SecuredMarks')
            flag=-1;
        if "TotalReapears" in HttpRequest.POST:
            TotalReappears=HttpRequest.POST["TotalReapears"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for TotalReappears')
            flag=-1;
        if "RepearsRemaining" in HttpRequest.POST:
            ReappearsRemaining=HttpRequest.POST["RepearsRemaining"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for ReappearsRemaining')
            flag=-1;
        if "DegreeType" in HttpRequest.session:
            DegreeType=HttpRequest.session["DegreeType"]
            del HttpRequest.session["DegreeType"]
        else:
            messages.error(HttpRequest,'ERROR : Please Choose a Session First')
            flag=-2;
        if "Board" in HttpRequest.POST:
            Boardid=HttpRequest.POST["Board"]
        else:
            messages.error(HttpRequest,'ERROR : Error fetching data from form for Board')
            flag=-1;
        if "Degree" in HttpRequest.session:
            _Degree=HttpRequest.session["Degree"]
            del HttpRequest.session["Degree"]
        else:
            messages.error(HttpRequest,'ERROR : Please Choose a Session First')
            flag=-2;
        Boardobj=Board.objects.all();
        yearlist=range(1985,2014);
        relist=range(0,20);
        if flag==-2:
            return HttpResponseRedirect('/userprofile/Marks/Marks/')
        
        if flag==-1:
            return HttpResponseRedirect('/message/')
        if 'MarksObjExists' in HttpRequest.session:
          if(HttpRequest.session['MarksObjExists'] == -1):
            result=MarksObj.InsertMarks(SessionStart, SessionEnd, _SessionNumber, SessionType, TotaMarks, SecuredMarks, TotalReappears, ReappearsRemaining, DegreeType, Boardid, _Degree, logindetails["userid"],logindetails["userid"], ip)
          else:
            result=MarksObj.UpdateMarks(HttpRequest.session['MarksObjExists'],SessionStart, SessionEnd, _SessionNumber, SessionType, TotaMarks, SecuredMarks, TotalReappears, ReappearsRemaining, DegreeType, Boardid, _Degree, logindetails["userid"],logindetails["userid"], ip)
          del HttpRequest.session['MarksObjExists']
        else:
          if(modelMarks.objects.filter(SessionNumber=_SessionNumber,Degree=_Degree,UserId=logindetails["userid"]).count()==0):
            result=MarksObj.InsertMarks(SessionStart, SessionEnd, _SessionNumber, SessionType, TotaMarks, SecuredMarks, TotalReappears, ReappearsRemaining, DegreeType, Boardid, _Degree, logindetails["userid"],logindetails["userid"], ip)
          else:
            _id=modelMarks.objects.get(SessionNumber=_SessionNumber,Degree=_Degree,UserId=logindetails["userid"]).id;
            result=MarksObj.UpdateMarks(_id,SessionStart, SessionEnd, _SessionNumber, SessionType, TotaMarks, SecuredMarks, TotalReappears, ReappearsRemaining, DegreeType, Boardid, _Degree, logindetails["userid"],logindetails["userid"], ip)
        if(result['result']==1):
          messages.info(HttpRequest,"SUCCESS.Your details have been recorded for %s" % (HttpRequest.session['Message_MarksFillingFor']))
        else:
          messages.error(HttpRequest,"result is %s"%result);
          return HttpResponseRedirect('/message/')
        if 'Message_MarksFillingFor' in HttpRequest.session:
          del HttpRequest.session['Message_MarksFillingFor']
        return HttpResponseRedirect('/userprofile/Marks/Marks/')
    except Exception, ex:
      frame = inspect.currentframe()
      args, _, _, values = inspect.getargvalues(frame)
      msg = ''
      for i in args:
        msg += "[%s : %s]" % (i,values[i])
      Logger_User.exception('%s : %s' % (inspect.getframeinfo(frame)[2],msg))
      messages.error(HttpRequest,'ERROR: ' + str(ex))
      return HttpResponseRedirect('/message/')
Exemple #9
0
def MedicalInfoInsert(HttpRequest):
    ip = HttpRequest.META['REMOTE_ADDR']
    logindetails = GetLoginDetails(HttpRequest)
    print logindetails
    if( logindetails["userid"] == -1):
        messages.error(HttpRequest,'Please Login to continue')
        return HttpResponseRedirect('/user/login/')
    try:
        UserProfileMiscObj=UserProfileMisc()
        flag=1
        if "Height" in HttpRequest.POST:
            Height=HttpRequest.POST["Height"]
            if is_integer(Height):
              Height=int(Height)
            else:
              messages.error(HttpRequest,"Error Height should be integer");
              flag=-1;
        else:
            messages.error(HttpRequest,"Error fetching data from form for Height");
            flag=-1;
        if "Weight" in HttpRequest.POST:
            Weight=HttpRequest.POST["Weight"]
            if is_integer(Weight):
              Weight=int(Weight)
            else:
              messages.error(HttpRequest,"Error Weight should be integer");
              flag=-1;
        else:
            messages.error(HttpRequest,"Error fetching data from form for Weight");
            flag=-1;
        if "LeftEye" in HttpRequest.POST:
            LeftEye=HttpRequest.POST["LeftEye"]
        else:
            messages.error(HttpRequest,"Error fetching data from form for LeftEye");
            flag=-1;
        if "RightEye" in HttpRequest.POST:
            RightEye=HttpRequest.POST["RightEye"]
        else:
            messages.error(HttpRequest,"Error fetching data from form for RightEye");
            flag=-1;
        if "DisabilityInfo" in HttpRequest.POST:
            DisabilityInfo=HttpRequest.POST["DisabilityInfo"]
        else:
            messages.error(HttpRequest,"Error fetching data from form for DisabilityInfo");
            flag=-1;
        if flag==-1:
            return HttpResponseRedirect('/message/')
        
        if "Id" in HttpRequest.POST:
            Id=HttpRequest.POST["Id"]
            result=UserProfileMiscObj.UpdateMedicalInfo(Id,logindetails["userid"], Height, Weight, LeftEye, RightEye, DisabilityInfo, logindetails["userid"], ip)
        else:
            result=UserProfileMiscObj.InsertMedicalInfo(logindetails["userid"], Height, Weight, LeftEye, RightEye, DisabilityInfo, logindetails["userid"], ip)
        if result['result']==-2:
          messages.error(HttpRequest,"You do not have privelege to this table.");
          messages.error(HttpRequest,"Either your profile is complete or you have not authenticated yourself");
        elif result['result']==1:
          messages.error(HttpRequest,"Congrats Your value has been saved");
          
        else:
          messages.error(HttpRequest,"result is %s"%result);
        return HttpResponseRedirect('/message/')
    except Exception, ex:
      frame = inspect.currentframe()
      args, _, _, values = inspect.getargvalues(frame)
      msg = ''
      for i in args:
        msg += "[%s : %s]" % (i,values[i])
      Logger_User.exception('%s : %s' % (inspect.getframeinfo(frame)[2],msg))
      messages.error(HttpRequest,'ERROR: ' + str(ex))
      return HttpResponseRedirect('/message/')