@@ -38,6 +38,10 @@ def gen_antd_pages(project_name_settings, user_label_list, focus_model=None, tem
3838 from django .conf import settings
3939 if not user_label_list :
4040 user_label_list = settings .TY_ADMIN_CONFIG ["GEN_APPS" ]
41+ try :
42+ force_cover = settings .TY_ADMIN_CONFIG ['FORCED_COVER' ]
43+ except KeyError :
44+ force_cover = False
4145 gen_labels = SYS_LABELS + user_label_list
4246 model_pic_dict = {}
4347 model_date_dict = {}
@@ -236,20 +240,37 @@ def gen_antd_pages(project_name_settings, user_label_list, focus_model=None, tem
236240 cur_path_co = f'{ target_path } /{ model_name } List/components'
237241 if not os .path .exists (cur_path_co ):
238242 os .makedirs (cur_path_co )
239- with open (f'{ target_path } /{ model_name } List/index.jsx' , 'w' , encoding = 'utf-8' ) as fw :
240- fw .write (new_content )
241-
242- with open (f'{ target_path } /{ model_name } List/service.js' , 'w' , encoding = 'utf-8' ) as fw :
243- fw .write (new_services )
244-
245- with open (f'{ target_path } /{ model_name } List/components/CreateForm.jsx' , 'w' , encoding = 'utf-8' ) as fw :
246- fw .write (create_form )
247-
248- with open (f'{ target_path } /{ model_name } List/components/UpdateForm.jsx' , 'w' , encoding = 'utf-8' ) as fw :
249- fw .write (update_form )
243+ index_jsx_path = f'{ target_path } /{ model_name } List/index.jsx'
244+ if not force_cover and os .path .exists (index_jsx_path ):
245+ pass
246+ else :
247+ with open (index_jsx_path , 'w' , encoding = 'utf-8' ) as fw :
248+ fw .write (new_content )
249+ service_jsx_path = f'{ target_path } /{ model_name } List/service.js'
250+ if not force_cover and os .path .exists (service_jsx_path ):
251+ pass
252+ else :
253+ with open (service_jsx_path , 'w' , encoding = 'utf-8' ) as fw :
254+ fw .write (new_services )
255+ create_form_path = f'{ target_path } /{ model_name } List/components/CreateForm.jsx'
256+ if not force_cover and os .path .exists (create_form_path ):
257+ pass
258+ else :
259+ with open (create_form_path , 'w' , encoding = 'utf-8' ) as fw :
260+ fw .write (create_form )
261+ update_form_path = f'{ target_path } /{ model_name } List/components/UpdateForm.jsx'
262+ if not force_cover and os .path .exists (update_form_path ):
263+ pass
264+ else :
265+ with open (update_form_path , 'w' , encoding = 'utf-8' ) as fw :
266+ fw .write (update_form )
250267 if app_name == user ._meta .app_label :
251- with open (f'{ target_path } /{ model_name } List/components/UpdatePasswordForm.jsx' , 'w' , encoding = 'utf-8' ) as fw :
252- fw .write (change_password_form )
268+ update_password_form_path = f'{ target_path } /{ model_name } List/components/UpdatePasswordForm.jsx'
269+ if not force_cover and os .path .exists (update_password_form_path ):
270+ pass
271+ else :
272+ with open (update_password_form_path , 'w' , encoding = 'utf-8' ) as fw :
273+ fw .write (change_password_form )
253274
254275
255276if __name__ == '__main__' :
0 commit comments