def GetNotification(Notification):
    Result = Hashing.GetAllFromHashing([{
        'Type': 'Notifications',
        'Data': Notification.User_Email,
        'Key': 'Email'
    }, {
        'Type': '',
        'Data': Notification.Type,
        'Key': 'Type'
    }, {
        'Type': 'Notifications',
        'Data': Notification.Message,
        'Key': 'Message'
    }])

    if Result['Result'] == -1:
        return ''

    Data = json.loads(Result['Data']['Message'])
    User = Users.objects.filter(Email=Hashing.Hash_Users(Data['Email']),
                                Deleted=0)
    if not User.exists():
        User = ''
    else:
        Hash = Hashing.Get_Hashed_Users(User[0].Name)
        if Hash['Result'] == -1:
            User = ''
        else:
            User = Hash['Data']

    Post = Posts.objects.filter(id=Data['PostID'], Deleted=0)
    if not Post.exists():
        Title = ''
    else:
        Hash = Hashing.Get_Hashed_Articles(Post[0].ArticleTitle)
        if Hash['Result'] == -1:
            Title = ''
        else:
            Title = Hash['Data']

    User = Span(User, 'Green')
    Title = Span(Title, 'Green')
    if Result['Data']['Type'] == 1:
        Message = 'User : '******' Liked Your Post : ' + Title
    elif Result['Data']['Type'] == 2:
        Message = 'User : '******' DisLiked Your Post : ' + Title
    elif Result['Data']['Type'] == 3:
        Message = 'User : '******' Commented in Your Post : ' + Title
    else:
        Message = 'User : '******' Added New Tag in Your Post : ' + Title

    return Div(P(Message))
def GetTheWholeNotification(Notification):
    Result = Hashing.GetAllFromHashing([{
        'Type': 'Notifications',
        'Data': Notification.User_Email,
        'Key': 'Email'
    }, {
        'Type': '',
        'Data': Notification.Type,
        'Key': 'Type'
    }, {
        'Type': 'Notifications',
        'Data': Notification.Message,
        'Key': 'Message'
    }, {
        'Type': 'Date',
        'Data': Notification.Date,
        'Key': 'Date'
    }])

    if Result['Result'] == -1:
        return ''

    Data = json.loads(Result['Data']['Message'])
    Comment = Data['Comment'] if 'Comment' in Data else ''
    User = Users.objects.filter(Email=Hashing.Hash_Users(Data['Email']),
                                Deleted=0,
                                Activate=1)
    if not User.exists():
        UserName = ''
        UserPicture = init.OfflineUser
        UserID = ''
    else:
        Hash = Hashing.GetAllFromHashing([{
            'Type': 'Users',
            'Data': User[0].Name,
            'Key': 'Name'
        }, {
            'Type': '',
            'Data': User[0].id,
            'Key': 'ID'
        }, {
            'Type': 'Users',
            'Data': User[0].Picture,
            'Key': 'Picture'
        }])

        if Hash['Result'] == -1:
            UserName = ''
            UserPicture = init.OfflineUser
            UserID = ''
        else:
            UserName = Hash['Data']['Name']
            UserPicture = Hash['Data']['Picture']
            UserID = Hash['Data']['ID']

    Post = Posts.objects.filter(id=Data['PostID'], Deleted=0)
    if not Post.exists():
        Title = ''
    else:
        Hash = Hashing.Get_Hashed_Articles(Post[0].ArticleTitle)
        if Hash['Result'] == -1:
            Title = ''
        else:
            Title = Hash['Data']

    if Notification.See == 0:
        Class = 'Notification DidNotSeeNotification'
    else:
        Class = 'Notification'

    from Register.models import Notifications
    Notifications.objects.filter(id=Notification.id).update(See=1)

    Title = Strong(Title)
    if Result['Data']['Type'] == 1:
        Message = 'This User Liked Your Post : ' + Title
    elif Result['Data']['Type'] == 2:
        Message = 'This User DisLiked Your Post : ' + Title
    elif Result['Data']['Type'] == 3:
        Message = 'This User Commented in Your Post : ' + Title
    else:
        Message = 'This User Added New Tag To Your Post : ' + Title

    return Div(
        Div(
            A(init.User + str(UserID), InputImage(UserPicture)) + Div(
                P(Strong('By : ') + UserName) +
                P(Strong('Date : ') + Result['Data']['Date']))) + Div(
                    P(Message) +
                    A(GetLink(Data['PostID'], Result['Data']['Type'], Comment),
                      'The Link For Article')), Class)