Django CMS 3.11.10 Documentationadmin_manager.filter(page=my_page, language="en") from djangocms_versioning.constants import DRAFT from djangocms_versioning.models import Version version = Version.objects.get(content__page=my_page, content__language="en" content in PageContent.admin_manager.filter(page=my_page).current_content(): # iterates over the current (draft or published) version of all languages of my page if content.versions.first().state == amongst the translated fields: placeholders = PlaceholderRelationField() @cached_property def my_placeholder(self): return get_placeholder_from_slot(self.placeholders, "slot_name") #0 码力 | 493 页 | 1.44 MB | 6 月前0.03
django cms 4.1.x DocumentationPageContents which may only be used on admin sites and admin forms: PageContent.admin_manager.filter(page=my_page, language="en") will retrieve page content objects of all versions. Alternatively, to get the DRAFT from djangocms_versioning.models import Version version = Version.objects.get(content__page=my_page, content__language="en",␣ ˓→status=DRAFT) draft_content = Version.content Finally, there are content in PageContent.admin_manager.filter(page=my_page).current_content(): # iterates over the current (draft or published) version of all languages of my page if content.versions.first().state == DRAFT:0 码力 | 357 页 | 1.99 MB | 1 年前3
django cms 4.1.1 Documentation
PageContents which may only be used on admin sites and admin forms: PageContent.admin_manager.filter(page=my_page, language="en") will retrieve page content objects of all versions. Alternatively, to get the DRAFT from djangocms_versioning.models import Version version = Version.objects.get(content__page=my_page, content__language="en",␣ ˓→status=DRAFT) draft_content = Version.content Finally, there are content in PageContent.admin_manager.filter(page=my_page).current_content(): # iterates over the current (draft or published) version of all languages of my page if content.versions.first().state == DRAFT:0 码力 | 361 页 | 2.00 MB | 1 年前3
Django CMS 4.1.x Documentationadmin_manager.filter(page=my_page, language="en") from djangocms_versioning.constants import DRAFT from djangocms_versioning.models import Version version = Version.objects.get(content__page=my_page, content__language="en" content in PageContent.admin_manager.filter(page=my_page).current_content(): # iterates over the current (draft or published) version of all languages of my page if content.versions.first().state == amongst the translated fields: placeholders = PlaceholderRelationField() @cached_property def my_placeholder(self): return get_placeholder_from_slot(self.placeholders, "slot_name") #0 码力 | 518 页 | 1.66 MB | 6 月前3
django cms 3.10.x Documentationmodels from cms.models.fields import PlaceholderField class MyModel(models.Model): # your fields my_placeholder = PlaceholderField('placeholder_name') # your methods The PlaceholderField has one required import PlaceholderField def my_placeholder_slotname(instance): return 'placeholder_name' class MyModel(models.Model): # your fields my_placeholder = PlaceholderField(my_placeholder_slotname) # your from the cms_tags template tag library: {% load cms_tags %} {% render_placeholder mymodel_instance.my_placeholder "640" %} The render_placeholder tag takes the following parameters: • PlaceholderField0 码力 | 296 页 | 1.79 MB | 1 年前3
django cms 3.1.x Documentationbase template. 12 Chapter 5. Table of contents django cms Documentation, Release 3.1.8.dev1 add my_site/templates/polls/base.html: {% extends 'base.html' %} {% block content %} {% block polls_content here polls_plugin/ # the newly-created application __init__.py admin.py models.py tests.py views.py my_site/ static/ project.db requirements.txt The Plugin Model In your poll application’s models.py add develop.py test 7. commit and push your code into a feature branch: git checkout -b my_fix git commit git push origin my_fix 8. open a pull request on github Target branches At one point in time django0 码力 | 200 页 | 1.63 MB | 1 年前3
Django CMS 3.0.x Documentationnavigation or styling. Let’s improve this by overriding the polls application’s base template. add my_site/templates/polls/base.html: 12 Chapter 5. Table of contents django cms Documentation, Release here polls_plugin/ # the newly-created application __init__.py admin.py models.py tests.py views.py my_site/ static/ project.db requirements.txt The Plugin Model In your poll application’s models.py add "/bye/", 2) n3 = NavigationNode(_('sample account page'), "/hello/", 3) n4 = NavigationNode(_('sample my profile page'), "/hello/world/", 4, 3) nodes.append(n) nodes.append(n2) nodes.append(n3) nodes.append(n4)0 码力 | 180 页 | 1.56 MB | 6 月前3
django cms 3.6.x Documentationmodels from cms.models.fields import PlaceholderField class MyModel(models.Model): # your fields my_placeholder = PlaceholderField('placeholder_name') # your methods The PlaceholderField has one required import PlaceholderField def my_placeholder_slotname(instance): return 'placeholder_name' class MyModel(models.Model): # your fields my_placeholder = PlaceholderField(my_placeholder_slotname) # your from the cms_tags template tag library: {% load cms_tags %} {% render_placeholder mymodel_instance.my_placeholder "640" %} The render_placeholder tag takes the following parameters: • PlaceholderField0 码力 | 278 页 | 1.63 MB | 1 年前3
django cms 3.7.x Documentationmodels from cms.models.fields import PlaceholderField class MyModel(models.Model): # your fields my_placeholder = PlaceholderField('placeholder_name') # your methods The PlaceholderField has one import PlaceholderField def my_placeholder_slotname(instance): return 'placeholder_name' class MyModel(models.Model): # your fields my_placeholder = PlaceholderField(my_placeholder_slotname) from the cms_tags template tag library: {% load cms_tags %} {% render_placeholder mymodel_instance.my_placeholder "640" %} The render_placeholder tag takes the following parameters: PlaceholderField0 码力 | 409 页 | 1.67 MB | 1 年前3
Django CMS 3.9.x Documentationfrom cms.models.fields import PlaceholderField class MyModel(models.Model): # your fields my_placeholder = PlaceholderField('placeholder_name') # your methods The PlaceholderField has one import PlaceholderField def my_placeholder_slotname(instance): return 'placeholder_name' class MyModel(models.Model): # your fields my_placeholder = PlaceholderField(my_placeholder_slotname) from the cms_tags template tag library: {% load cms_tags %} {% render_placeholder mymodel_instance.my_placeholder "640" %} The render_placeholder tag takes the following parameters: PlaceholderField instance0 码力 | 417 页 | 1.68 MB | 6 月前3
共 89 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9













