main
Jaap Joris Vens 2024-12-10 23:18:23 +01:00
rodzic 9b4cea413c
commit 1e290aec9c
1 zmienionych plików z 24 dodań i 18 usunięć

Wyświetl plik

@ -29,26 +29,30 @@ lets them assign sections to pages and fill sections with content.
Here's an example `views.py` of an app using SimpleCMS: Here's an example `views.py` of an app using SimpleCMS:
from cms.views import SectionView ```python
from cms.decorators import section_view from cms.views import SectionView
from cms.decorators import section_view
@section_view @section_view
class HelloWorld(SectionView): class HelloWorld(SectionView):
verbose_name = 'Hello world section' verbose_name = 'Hello world section'
fields = ['content'] fields = ['content']
template_name = 'hello.html' template_name = 'hello.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context['message'] = 'Hello World!' context['message'] = 'Hello World!'
return context return context
```
And here is the contents of `hello.html`: And here is the contents of `hello.html`:
<section type="helloworld"> ```html
<h1>{{ message }}</h1> <section type="helloworld">
{{ section.content }} <h1>{{ message }}</h1>
</section> {{ section.content }}
</section>
```
Everytime a section needs to be rendered, SimpleCMS will call the Everytime a section needs to be rendered, SimpleCMS will call the
appropriate section view and insert the rendered result into the final appropriate section view and insert the rendered result into the final
@ -73,7 +77,9 @@ SimpleCMS includes a variety of useful template tags, default *Page*
and *Section* models, and all the other boilerplate code needed for and *Section* models, and all the other boilerplate code needed for
new projects. new projects.
## Feedback and support ## Feedback
We would love to hear from you! Feel free to [open an We love to hear from you! Feel free to [open an
issue](../../issues) or [send us an email](mailto:cms@jj.rtts.eu). issue](https://github.com/rtts/django-simplecms) or fill out the
contact form on [our website](https://rtts.eu/) (which is of course
built with SimpleCMS!)