Exemplo n.º 1
0
def user_list_datagrid(request):
    ### need to hand pick fields from TegakiUser, if some are None, need to pass back empty strings for dojo
    dojo_obs = []
    users, num = datagrid_helper(TegakiUser, request)
    for u in users:
        djob = {}
        #'id', 'user__username', 'country', 'lang', 'description', 'n_handwriting_samples'
        djob['id'] = u.user.id
        djob['user__username'] = u.user.username
        if u.country:
            djob['country'] = u.country
        if u.lang:
            djob['lang__description'] = u.lang.description
        if u.description:
            djob['description'] = u.description
        if u.show_handwriting_samples:  #only if they publicly display their samples
            djob['n_handwriting_samples'] = u.n_handwriting_samples
        dojo_obs += [djob]
    return to_dojo_data(dojo_obs, identifier='user__username', num_rows=num)
Exemplo n.º 2
0
def user_list_datagrid(request):
    ### need to hand pick fields from TegakiUser, if some are None, need to pass back empty strings for dojo
    dojo_obs = []
    users, num = datagrid_helper(TegakiUser, request)
    for u in users:
        djob = {}
        #'id', 'user__username', 'country', 'lang', 'description', 'n_handwriting_samples'
        djob['id'] = u.user.id
        djob['user__username'] = u.user.username
        if u.country:
            djob['country'] = u.country
        if u.lang:
            djob['lang__description'] = u.lang.description
        if u.description:
            djob['description'] = u.description
        if u.show_handwriting_samples:  #only if they publicly display their samples
            djob['n_handwriting_samples'] = u.n_handwriting_samples
        dojo_obs += [djob]
    return to_dojo_data(dojo_obs, identifier='user__username', num_rows=num)
Exemplo n.º 3
0
def samples_datagrid(request):
    ### need to hand pick fields from TegakiUser, if some are None, need to pass back empty strings for dojo
    dojo_obs = []
    samples, num = datagrid_helper(HandWritingSample, request)
    for s in samples:
        djob = {}
        #'id', 'user__username', 'country', 'lang', 'description', 'n_handwriting_samples'
        djob['id'] = s.id
        djob['character__utf8'] = s.character.utf8()
        djob['character__lang__description'] = s.character.lang.description
        djob['date'] = s.date
        djob['user__username'] = s.user.username
        if s.user.get_profile().show_handwriting_samples or request.user == s.user: 
            #only if they publicly display this charset
            #or it's their charset
            dojo_obs += [djob]
        else:
            num = num -1
    return to_dojo_data(dojo_obs, identifier='id', num_rows=num)
Exemplo n.º 4
0
def samples_datagrid(request):
    ### need to hand pick fields from TegakiUser, if some are None, need to pass back empty strings for dojo
    dojo_obs = []
    samples, num = datagrid_helper(HandWritingSample, request)
    for s in samples:
        djob = {}
        #'id', 'user__username', 'country', 'lang', 'description', 'n_handwriting_samples'
        djob['id'] = s.id
        djob['character__utf8'] = s.character.utf8()
        djob['character__lang__description'] = s.character.lang.description
        djob['date'] = s.date
        djob['character_set__name'] = s.character_set.name
        djob['user__username'] = s.user.username
        if s.user.get_profile().show_handwriting_samples or request.user == s.user: 
            #only if they publicly display this charset
            #or it's their charset
            dojo_obs += [djob]
        else:
            num = num -1
    return to_dojo_data(dojo_obs, identifier='id', num_rows=num)
Exemplo n.º 5
0
def assignments_datagrid(request):
    ### need to hand pick fields from Assignments, if some are None, need to pass back empty strings for dojo
    dojo_obs = []
    assignments, num = datagrid_helper(Assigment, request)
    for a in assignments:
        djob = {}
        #'id', 'user__username', 'country', 'lang', 'description', 'n_handwriting_samples'
        djob['id'] = a.id
        #djob['character__utf8'] = s.character.utf8()
        #djob['character__lang__description'] = s.character.lang.description
        #djob['date'] = s.date
        #djob['character_set__name'] = s.character_set.name
        #djob['user__username'] = s.user.username
        #if s.user.get_profile().show_handwriting_samples or request.user == s.user: 
            #only if they publicly display this charset
            #or it's their charset
        #    dojo_obs += [djob]
        #else:
        #    num = num -1
    return to_dojo_data(dojo_obs, identifier='id', num_rows=num)
Exemplo n.º 6
0
def charset_datagrid(request):
    ### need to hand pick fields from TegakiUser, if some are None, need to pass back empty strings for dojo
    dojo_obs = []
    charsets, num = datagrid_helper(CharacterSet, request)
    for c in charsets:
        djob = {}
        #'id', 'user__username', 'country', 'lang', 'description', 'n_handwriting_samples'
        djob['id'] = c.id
        djob['name'] = c.name
        djob['lang__description'] = c.lang.description
        djob['description'] = c.description
        djob['random_char'] = unichr(c.get_random())
        djob['characters'] = c.characters       #might want to do something else for display
        if c.user:
            djob['user__username'] = c.user.username
        if c.public or request.user == c.user:  #only if they publicly display this charset
                                                #or it's their charset
            dojo_obs += [djob]
        else:
            num = num -1
    return to_dojo_data(dojo_obs, identifier='id', num_rows=num)
Exemplo n.º 7
0
def charset_datagrid(request):
    ### need to hand pick fields from TegakiUser, if some are None, need to pass back empty strings for dojo
    dojo_obs = []
    charsets, num = datagrid_helper(CharacterSet, request)
    for c in charsets:
        print c
        djob = {}
        #'id', 'user__username', 'country', 'lang', 'description', 'n_handwriting_samples'
        djob['id'] = c.id
        djob['name'] = c.name
        djob['lang__description'] = c.lang.description
        djob['description'] = c.description
        #print c.get_random()
        djob['random_char'] = unichr(c.get_random())
        #djob['characters'] = c.characters       #might want to do something else for display
        djob['number_of_characters'] = len(c)
        if c.user:
            djob['user__username'] = c.user.username
        if c.public or request.user == c.user:  #only if they publicly display this charset
                                                #or it's their charset
            dojo_obs += [djob]
        else:
            num = num -1
    return to_dojo_data(dojo_obs, identifier='id', num_rows=num)