a #e+@sLddlZddlZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZmZmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%m&Z&m'Z'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z3m4Z4GdddeZ5ej67e%e5Gdddej8Z9ej67e&e9ej67eej8Gdddej8Z:ej67e'e:Gddde*j;Zej67ee>Gd#d$d$ej?Z@Gd%d&d&eZej6Aeej67eedS)'N)url)admin)messages)HttpResponseRedirect)reverse) format_html)GuardedModelAdmin) UserAdmin)User) PluginDatum)Preset)Plugin)Profile)get_plugin_by_name enable_plugindisable_plugin delete_plugin valid_pluginget_plugins_persistent_pathclear_plugins_cache init_plugins)ProjectTaskSettingTheme)forms)CodeMirrorEditor)settings)InMemoryUploadedFile) gettext_lazygettextc@seZdZdZdZdZdS) ProjectAdmin)idnameowner created_at tasks_counttags)r%)r#r$Zowner__usernameN)__name__ __module__ __qualname__ list_display list_filter search_fieldsr/r//webodm/app/admin.pyr"sr"c@s eZdZddZdZdZdZdS) TaskAdmincCsdSNFr/selfrequestr/r/r0has_add_permission(szTaskAdmin.has_add_permission)r#r$projectprocessing_noder&status last_error)r9r7)r#r$Z project__nameN)r)r*r+r6r,r-r.r/r/r/r0r1'sr1c@seZdZddZdS) SettingAdmincCstj}|dkS)Nr)robjectsallcount)r4r5r>r/r/r0r67szSettingAdmin.has_add_permissionN)r)r*r+r6r/r/r/r0r;5sr;c@seZdZejededdedddddZejed ed ded ddddZejed ed ded ddddZ ejededded ddddZ ejededded ddddZ GdddZ dS)ThemeModelFormzEnter custom CSSCSSFcssT)modeZ lineNumbers)options) help_textlabelrequiredwidgetz-HTML that will be displayed above site headerzHTML (before header)xmlz-HTML that will be displayed after site headerzHTML (after header)z.HTML that will be displayed after the body tagzHTML (after body)zoHTML that will be displayed in the footer. You can also use the special tags such as {ORGANIZATION} and {YEAR}.z HTML (footer)c@seZdZeZdZdS)zThemeModelForm.Meta__all__N)r)r*r+rmodelfieldsr/r/r/r0MetaWsrLN) r)r*r+r CharField_rrAhtml_before_headerhtml_after_headerhtml_after_body html_footerrLr/r/r/r0r?@s8    r?c@seZdZeZdS) ThemeAdminN)r)r*r+r?formr/r/r/r0rS\srScseZdZdZdZdZddZd ddZd d Ze d e_ d d Z e de _ ddZ e de _ fddZ ddZddZddZddZddZe de_ de_ZS)! PluginAdmin)r$ descriptionversionauthorenabledplugin_actionsr$zadmin/change_list_plugin.htmlcCsdSr2r/r3r/r/r0r6iszPluginAdmin.has_add_permissionNcCsdSr2r/)r4r5objr/r/r0has_delete_permissionlsz!PluginAdmin.has_delete_permissioncCs$t|jddd}t|ddS)NFT only_activeZrefresh_cache_if_nonerV)rr$ get_manifestrNgetr4r\manifestr/r/r0rVoszPluginAdmin.description DescriptioncCs t|jddd}|ddS)NFTr^rWr`rr$rarbrcr/r/r0rWuszPluginAdmin.versionVersioncCs t|jddd}|ddS)NFTr^rXr`rfrcr/r/r0rX{szPluginAdmin.authorZAuthorcsnt}td|j|jddtd|j|jddtd|j|jddtd|j|jd dg}||S) Nz^(?P.+)/enable/$z plugin-enabler[z^(?P.+)/disable/$zplugin-disablez^(?P.+)/delete/$z plugin-deletez^actions/upload/$z plugin-upload) superget_urlsr admin_site admin_view plugin_enableplugin_disable plugin_delete plugin_upload)r4urlsZ custom_urls __class__r/r0ris.     zPluginAdmin.get_urlsc Os|z,t|}|r*t|tdd|iWnBtyn}z*t|td|t|dWYd}~n d}~00ttdS)Nz{} {}z$      zadmin:plugin-disable)r}#disabledr`ZDisablezadmin:plugin-enableZEnablezadmin:plugin-delete)rr$rZ is_persistentrYrpkrN)r4r\rsr/r/r0rZs  zPluginAdmin.plugin_actionsActionsT)N)r)r*r+r,readonly_fieldschange_list_templater6r]rVrNshort_descriptionrWrXrirlrmrnrorZ allow_tags __classcell__r/r/rqr0rUds&        7 rUc@seZdZeZdZdS) ProfileInlineFN)r)r*r+rrJ can_deleter/r/r/r0r src@seZdZegZdS)r N)r)r*r+rinlinesr/r/r/r0r sr )Brrrrdjango.conf.urlsrZdjango.contribrr django.httpr django.urlsrdjango.utils.htmlrZguardian.adminrZdjango.contrib.auth.adminr Z BaseUserAdmindjango.contrib.auth.modelsr Z app.modelsr r r r app.pluginsrrrrrrrrmodelsrrrrdjangorZcodemirror2.widgetsrZwebodmrdjango.core.files.uploadedfilerdjango.utils.translationr rNr!r"siteregister ModelAdminr1r; ModelFormr?rSrU StackedInliner unregisterr/r/r/r0sR             (     &