35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
#!/bin/python
|
|
#coding: utf-8
|
|
# +-------------------------------------------------------------------
|
|
# | django-vue-lyadmin
|
|
# +-------------------------------------------------------------------
|
|
# | Author: lybbn
|
|
# +-------------------------------------------------------------------
|
|
# | QQ: 1042594286
|
|
# +-------------------------------------------------------------------
|
|
|
|
# ------------------------------
|
|
# 代码生成--urls
|
|
# ------------------------------
|
|
|
|
from django.template import Template,Context
|
|
|
|
def lyGenerateUrls(object):
|
|
urls_code = """# -*- coding: utf-8 -*-
|
|
|
|
#路由文件
|
|
#此文件请放在lyFormBuilder的urls目录中
|
|
|
|
from django.urls import path, re_path
|
|
from rest_framework import routers
|
|
|
|
from apps.lyFormBuilder.views.views_{{object.formConfig.modelClassName}} import {{object.formConfig.modelClassName}}ViewSet
|
|
|
|
system_url = routers.SimpleRouter()
|
|
system_url.register(r'{{ object.formConfig.modelClassName }}', {{object.formConfig.modelClassName}}ViewSet)
|
|
|
|
urlpatterns = []
|
|
urlpatterns += system_url.urls
|
|
"""
|
|
context = Context({'object': object})
|
|
return Template(urls_code).render(context) |