CRM-kingadmin开发设计

Posted jintian

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CRM-kingadmin开发设计相关的知识,希望对你有一定的参考价值。

通过字符串导入模块

importlib.import_module()

__import__() 

技术图片
from django.shortcuts import render,redirect
from django.contrib.auth import authenticate,login,logout
from django.contrib.auth.decorators import login_required
from django import conf
from kingadmin import app_setup
from crm import models
app_setup.kingadmin_auto_discover()


from kingadmin.sites import  site
print("sites.",site.enabled_admins)

# for k,v in site.enabled_admins.items():
#     for table_name,admin_class in v.items():
#         print(table_name,id(admin_class))
# # Create your views here.


def app_index(request):
    #enabled_admins =

    return render(request,kingadmin/app_index.html, site:site)

def get_filter_result(request,querysets):
    filter_conditions = 
    for key,val in request.GET.items():
        if val:
            filter_conditions[key] =  val


    print("filter_conditions",filter_conditions)
    return querysets.filter(**filter_conditions),filter_conditions

@login_required
def table_obj_list(request,app_name,model_name):
    """取出指定model里的数据返回给前端"""
    #print("app_name,model_name:",site.enabled_admins[app_name][model_name])
    admin_class = site.enabled_admins[app_name][model_name]
    querysets = admin_class.model.objects.all()

    querysets,filter_condtions  = get_filter_result(request,querysets)
    admin_class.filter_condtions = filter_condtions

    print(request.GET)
    #print("admin class",admin_class.model )

    return render(request,kingadmin/table_obj_list.html, querysets:querysets,admin_class:admin_class)


def acc_login(request):
    error_msg = ‘‘
    if request.method == "POST":
        username = request.POST.get(username)
        password = request.POST.get(password)

        user = authenticate(username=username,password=password)
        if user:
            print("passed authencation",user)
            login(request,user)
            #request.user = user

            return  redirect( request.GET.get(next,/kingadmin/) )
        else:
            error_msg = "Wrong username or password!"
    return render(request, kingadmin/login.html, error_msg:error_msg)


def acc_logout(request):
    logout(request)
    return redirect("/login/")
views

技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片        

以上是关于CRM-kingadmin开发设计的主要内容,如果未能解决你的问题,请参考以下文章

DCloud开发

ui设计设计题目

设计概要设计-详细设计-到底需要输出什么???

Web前端设计是就是网站设计?

理顺软件开发各个环节-13(开发管理-概要设计和详细设计)

理顺软件开发各个环节-13(开发管理-概要设计和详细设计)