示例#1
0
def get_post_types(request, page):
    response = reply_object()
    try:
        named_form = NamedObjectForm(initial = {"named_object_type" : "PostType"})
        name_list = PostType.objects.all()
        generic_links = get_generic_links('PostType')
        generic_links['edit_onclick'] = 'App.NamedObject.show_form'
        generic_links['delete_onclick'] = 'App.NamedObject.delete_object'
        print generic_links['add_new_link']
        generic_list_dict = generic_list_page_dict(name_list,
                                                   ["name"],
                                                   generic_links,
                                                   per_page = 20,
                                                   url="#/property/name/",
                                                   page = page)
        print generic_links['add_new_link']
        page = render_to_string("generic_list_page.html",
                                {"generic_list_dict" : generic_list_dict,
                                 "generic_links" : generic_links,
                                 "named_form" : named_form})
        response["code"] = settings.APP_CODE["PAGE LOADED"]
        response["page"] = page
    except:
        response["code"] = settings.APP_CODE["SYSTEM ERROR"]
    return HttpResponse(simplejson.dumps(response))
示例#2
0
def list_user(request, page):
    response = reply_object()
    try:
        object_list = AppUser.objects.all()
        generic_links = get_generic_links('AppUser')
        generic_links['edit_onclick'] = ''
        generic_links['delete_onclick'] = 'App.AppUser.delete_user'
        generic_links['edit_link'] = '#/edit/user/'
        generic_list_dict = generic_list_page_dict(object_list,
                                                   ["nickname"],
                                                   generic_links,
                                                   url = "#/list/user/",
                                                   per_page = 20,
                                                   page = page)
        page = render_to_string("generic_list_page.html",
                                {"generic_list_dict" : generic_list_dict,
                                 "generic_links" : generic_links})
        response["code"] = settings.APP_CODE["PAGE LOADED"]
        response["page"] = page
    except:
        response["code"] = settings.APP_CODE["SYSTEM ERROR"]
    return HttpResponse(simplejson.dumps(response))
示例#3
0
def list_item_unit(request, page):
    response = reply_object()
    try:
        named_form = NamedObjectForm(initial = {"named_object_type" : "ItemUnit"})
        object_list = ItemUnit.objects.all()
        generic_links = get_generic_links('Company')
        generic_links['edit_onclick'] = 'App.NamedObject.show_form'
        generic_links['delete_onclick'] = 'App.NamedObject.delete_object'
        generic_list_dict = generic_list_page_dict(object_list,
                                                   ["name"],
                                                   generic_links,
                                                   url = "#/list/itemunit/",
                                                   per_page = 20,
                                                   page = page)
        page = render_to_string("generic_list_page.html",
                                {"generic_list_dict" : generic_list_dict,
                                 "generic_links" : generic_links,
                                 "named_form" : named_form})
        response["code"] = settings.APP_CODE["PAGE LOADED"]
        response["page"] = page
    except:
        response["code"] = settings.APP_CODE["SYSTEM ERROR"]
    return HttpResponse(simplejson.dumps(response))
示例#4
0
def purchase_list(request, page):
    response = reply_object()
    try:
        object_list = Purchase.objects.select_related().all()
        generic_links = get_generic_links('Purchase')
        generic_links['edit_onclick'] = ''
        generic_links['delete_onclick'] = ''
        generic_links['edit_link'] = '#/purchase/'
        generic_links['add_new_link'] = '#/distributor/'
        generic_links['add_new_onclick'] = ''
        generic_list_dict = generic_list_page_dict(object_list,
                                                   ["_item_cache", "number"],
                                                   generic_links,
                                                   url = "#/list/distributors/",
                                                   per_page = 20,
                                                   page = page)
        page = render_to_string("generic_list_page.html",
                                {"generic_list_dict" : generic_list_dict,
                                 "generic_links" : generic_links})
        response["code"] = settings.APP_CODE["PAGE LOADED"]
        response["page"] = page
    except:
        response["code"] = settings.APP_CODE["SYSTEM ERROR"]
    return HttpResponse(simplejson.dumps(response))
示例#5
0
def list_distributors(request, page):
    response = reply_object()
    try:
        object_list = Distributor.objects.all()
        generic_links = get_generic_links('Distributor')
        generic_links['edit_onclick'] = ''
        generic_links['delete_onclick'] = 'App.Distributor.delete_distributor'
        generic_links['edit_link'] = '#/distributor/'
        generic_links['add_new_link'] = '#/distributor/'
        generic_links['add_new_onclick'] = ''
        generic_list_dict = generic_list_page_dict(object_list,
                                                   ["name", "phone_number"],
                                                   generic_links,
                                                   url = "#/list/distributors/",
                                                   per_page = 20,
                                                   page = page)
        page = render_to_string("generic_list_page.html",
                                {"generic_list_dict" : generic_list_dict,
                                 "generic_links" : generic_links})
        response["code"] = settings.APP_CODE["PAGE LOADED"]
        response["page"] = page
    except:
        response["code"] = settings.APP_CODE["SYSTEM ERROR"]
    return HttpResponse(simplejson.dumps(response))