28 @template_config(template='templates/contact-custom.pt', layer=IPyAMSLayer) |
28 @template_config(template='templates/contact-custom.pt', layer=IPyAMSLayer) |
29 class ContactParagraphCustomRenderer(ContactParagraphDefaultRenderer): |
29 class ContactParagraphCustomRenderer(ContactParagraphDefaultRenderer): |
30 """Context paragraph custom renderer""" |
30 """Context paragraph custom renderer""" |
31 |
31 |
32 label = _("Custom contact renderer") |
32 label = _("Custom contact renderer") |
33 settings_interface = IContactParagraphDefaultRendererSettings |
33 #settings_interface = IContactParagraphDefaultRendererSettings |
34 |
34 |
35 |
35 |
36 In this example, we have defined an adapter named 'custom' with :py:class:`IContactParagraph`, |
36 In this example, we have defined an adapter named 'custom' with :py:class:`IContactParagraph`, |
37 :py:class:`IPyAMSLayer` as context and provides :py:class:`ISharedContentRenderer` interface. |
37 :py:class:`IPyAMSLayer` as context and provides :py:class:`ISharedContentRenderer` interface. |
38 |
38 |
39 Using ``@template_config()`` decorator, the renderer will be displayed in html container according to the template |
39 Using ``@template_config()`` decorator, the renderer will be displayed in html container according to the template |
|
40 `templates/contact-custom.pt` |
40 |
41 |
41 The new renderer inherit of :py:class:`ContactParagraphDefaultRenderer`, have a new **label** (line 8) |
42 The new renderer inherit of :py:class:`ContactParagraphDefaultRenderer`, have a new **label** (line 8) |
42 and is associated an **settings_interface** (line 9) |
43 and this associated **settings_interface** is not modify(line 9) |
43 |
44 |
44 .. tip:: |
45 .. tip:: |
45 |
46 |
46 You can override the template of a renderer easily with the function :py:func:`pyams_template.template.override_template` |
47 You can override the template of a renderer easily with the function :py:func:`pyams_template.template.override_template` |
47 It's takes the context and the new template path as params. |
48 It's takes the context and the new template path as params. |
|
49 |
48 |
50 |
49 |
51 |
50 2. Create a new Renderer from scratch |
52 2. Create a new Renderer from scratch |
51 ------------------------------------- |
53 ------------------------------------- |
52 |
54 |