Esempio n. 1
0
def enchants_json(request):
    '''エンチャント一覧の json インタフェース'''
    
    order = request.GET.get('orderby')
    if order and request.GET.get('sortorder') == 'descending':
        order = '-' + order

    limit = request.GET.get('max-results')
    if limit: limit = int(limit)
    else: limit = 50

    callback = request.GET.get('callback')

    cond = {}
    cond_names = ['name', 'rank', 'root', 'equipment', 'effects']
    for name in cond_names:
        value = request.GET.get(name)
        if value:
            cond[name] = value

    q = EnchantClass.find(order=order, limit=limit, **cond)

    items = []
    for i in q:
        items.append(to_enchant_map(i))

    return HttpResponse(create_feed(items, callback)) # , 'application/json')
Esempio n. 2
0
def enchants(request):
    '''エンチャントをすべて表示する'''

    context = {
        'items': EnchantClass.all()
        }
    return direct_to_template(request, 'enchants_admin.html', context)
Esempio n. 3
0
def delete_all(request):
    '''データを全て削除する'''

    db.delete(EnchantClass.all(keys_only=True))

    context = {}

    return direct_to_template(request, 'update_result.html', context)
Esempio n. 4
0
def enchants(request):
    """エンチャント一覧を表示する
    """
    
    context = {
        'enchants': EnchantClass.all(),
        }

    return direct_to_template(request, 'enchants.html', context)
Esempio n. 5
0
 def _put_enchants(self, enchants):
     result = []
     for enchant in enchants:
         model = EnchantClass.create_or_update(**enchant)
         result.append(model)
     return result