Exemple #1
0
def hide(Req, Id):
    if not Req.user.is_authenticated():
        return json_denied(Req)
    else:
        MyMsg = main.models.Msg.objects.get(id=int(Id))
        if MyMsg.user_from == Req.user:
            MyMsg.user_hide_from = "true"
            MyMsg.save()
            return json_true(Req)

        if MyMsg.user_to == Req.user:
            MyMsg.user_hide_to = "true"
            MyMsg.save()
            return json_true(Req)

        return json_denied(Req)
Exemple #2
0
def hide(Req, Id):
          if not Req.user.is_authenticated():
             return json_denied(Req)  
          else:                  
             MyMsg = main.models.Msg.objects.get(id = int(Id) )
             if MyMsg.user_from == Req.user:
                   MyMsg.user_hide_from = "true"
                   MyMsg.save()
                   return json_true(Req)    
                   
             if MyMsg.user_to == Req.user:
                   MyMsg.user_hide_to = "true"
                   MyMsg.save()      
                   return json_true(Req)
             
             return json_denied(Req)
Exemple #3
0
def user_settings(Req, Name, Value):
        if not Req.user.is_authenticated():
                return json_denied(Req, {"ru_description": u"Для изменения персональных настроек пожайлуста авторизируйтесь"})
  
        if Value == "yes":
                Value = "yes"
        else:
                Value = "no"
                
        Setting = None
        try : 
              Setting = CustomSettings.objects.get(title = Name)
              Object = UserCustomSettings.objects.get(user  = Req.user, setting = Setting  )
              Object.value = Value
              Object.save()
              return json_true(Req)
        except UserCustomSettings.DoesNotExist:  
              obj = UserCustomSettings(user  = Req.user, setting = Setting, value = Value  )
              obj.save()
              return json_true(Req)
Exemple #4
0
def user_settings(Req, Name, Value):
    if not Req.user.is_authenticated():
        return json_denied(
            Req, {
                "ru_description":
                u"Для изменения персональных настроек пожайлуста авторизируйтесь"
            })

    if Value == "yes":
        Value = "yes"
    else:
        Value = "no"

    Setting = None
    try:
        Setting = CustomSettings.objects.get(title=Name)
        Object = UserCustomSettings.objects.get(user=Req.user, setting=Setting)
        Object.value = Value
        Object.save()
        return json_true(Req)
    except UserCustomSettings.DoesNotExist:
        obj = UserCustomSettings(user=Req.user, setting=Setting, value=Value)
        obj.save()
        return json_true(Req)