Django CMS:创建页面时设置默认占位符值

时间:2018-11-29 16:01:01

标签: python plugins django-cms

我是Django CMS的新手。创建新页面时,必须选择占位符和插件。是否可以将所有默认插件设置为post_save?谢谢。

1 个答案:

答案 0 :(得分:1)

您可以通过在# using the same reproducible data from the question/example cities <- read.csv( textConnection("City,Lat,Long,Pop Boston,42.3601,-71.0589,645966 Hartford,41.7627,-72.6743,125017 New York City,40.7127,-74.0059,8406000 Philadelphia,39.9500,-75.1667,1553000 Pittsburgh,40.4397,-79.9764,305841 Providence,41.8236,-71.4222,177994 ")) leaflet(cities) %>% addProviderTiles(providers$OpenStreetMap) %>% # these markers will appear on your map: addCircleMarkers( lng = ~Long, lat = ~Lat, weight = 1, fillOpacity = 0.5, radius = ~sqrt(Pop)/50, popup = ~City, label = ~City, group ='circles' # group needs to be different than addMarkers() ) %>% addResetMapButton() %>% # these markers will be "invisible" on the map: addMarkers( data = cities, lng = ~Long, lat = ~Lat, label = cities$City, group = 'cities', # this is the group to use in addSearchFeatures() # make custom icon that is so small you can't see it: icon = makeIcon( iconUrl = "http://leafletjs.com/examples/custom-icons/leaf-green.png", iconWidth = 1, iconHeight = 1 ) ) %>% addSearchFeatures( targetGroups = 'cities', # group should match addMarkers() group options = searchFeaturesOptions( zoom=12, openPopup = TRUE, firstTipSubmit = TRUE, autoCollapse = TRUE, hideMarkerOnCollapse = TRUE ) ) %>% addControl("<P><B>Hint!</B> Search for ...<br/><ul><li>New York</li> <li>Boston</li><li>Hartford</li><li>Philadelphia</li><li>Pittsburgh</li> <li>Providence</li></ul></P>", position = 'bottomright' ) 中设置占位符的default_plugins属性来进行设置;

CMS_PLACEHOLDER_CONF

然后,将使用包含CMS_PLACEHOLDER_CONF = { 'content': { 'plugins': ['TextPlugin', 'PicturePlugin'], 'name': gettext("Content"), 'language_fallback': True, 'default_plugins': [ { 'plugin_type': 'TextPlugin', 'values': { 'body':'<p>Default text plugin for the `content` placeholder...</p>', }, }, ], }, } 内容content的{​​{1}}创建带有TextPlugin占位符的任何页面

此文档可在此处找到; http://docs.django-cms.org/en/latest/reference/configuration.html#cms-placeholder-conf