Skip to content

Commit 11a97fd

Browse files
committed
Deprecate Template
1 parent 9ab922e commit 11a97fd

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Change log
55
Next version
66
============
77

8+
- Removed mentions of the ``Template`` type from the docs and deprecated the
9+
class. django-content-editor never used it, only FeinCMS did; feincms3 ships
10+
its own ``TemplateType`` type replacing it.
11+
812

913
7.2 (2025-01-27)
1014
================

content_editor/models.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
from django.core.exceptions import ImproperlyConfigured
24
from django.db import models
35

@@ -43,6 +45,14 @@ def __init__(self, *, key, **kwargs):
4345
class Template(Type):
4446
_REQUIRED = {"key", "template_name", "title", "regions"}
4547

48+
def __init__(self, **kwargs):
49+
super().__init__(**kwargs)
50+
warnings.warn(
51+
"Template is deprecated, use feincms3's TemplateType instead.",
52+
DeprecationWarning,
53+
stacklevel=2,
54+
)
55+
4656

4757
def create_plugin_base(content_base):
4858
"""

docs/index.rst

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -381,26 +381,6 @@ You are free to define additional attributes -- simply pass them
381381
when instantiating a new region.
382382

383383

384-
Templates
385-
~~~~~~~~~
386-
387-
Various classes will expect the main model to have a ``template``
388-
attribute or property which returns a ``Template`` instance.
389-
django-content-editor does not use the template class itself, but
390-
feincms3 includes a mixin which allows content managers to choose from a
391-
selection of templates per model instance.
392-
393-
Templates have the following attributes:
394-
395-
* ``title``: Something nice.
396-
* ``key``: The template key. Must contain a valid Python identifier.
397-
* ``template_name``: A template path.
398-
* ``regions``: A list of region instances.
399-
400-
As with the regions above, you are free to define additional
401-
attributes.
402-
403-
404384
``Contents`` class and helpers
405385
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
406386

0 commit comments

Comments
 (0)