django-camomilla-cms 6.0.0b18__tar.gz → 6.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_camomilla_cms-6.1.0/PKG-INFO +133 -0
- django_camomilla_cms-6.1.0/README.md +102 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/__init__.py +1 -1
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/models/page.py +22 -10
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/base/__init__.py +9 -5
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/page.py +4 -3
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/settings.py +22 -3
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templatetags/model_extras.py +8 -4
- django_camomilla_cms-6.1.0/camomilla/theme/__init__.py +1 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/theme/admin/pages.py +20 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/urls.py +3 -3
- django_camomilla_cms-6.1.0/camomilla/utils/templates.py +53 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/base/__init__.py +4 -2
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/menus.py +8 -3
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/mixins/pagination.py +1 -1
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/pages.py +4 -4
- django_camomilla_cms-6.1.0/django_camomilla_cms.egg-info/PKG-INFO +133 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/django_camomilla_cms.egg-info/SOURCES.txt +3 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/django_camomilla_cms.egg-info/requires.txt +3 -1
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/pyproject.toml +4 -2
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/setup.py +1 -1
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/fixtures/__init__.py +3 -6
- django_camomilla_cms-6.1.0/tests/test_admin_page_form.py +63 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/test_camomilla_filters.py +7 -3
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/test_media.py +54 -15
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/test_menu.py +33 -18
- django_camomilla_cms-6.1.0/tests/test_model_api.py +113 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/test_model_api_permissions.py +7 -2
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/test_model_api_register.py +118 -156
- django_camomilla_cms-6.1.0/tests/test_page_meta.py +88 -0
- django_camomilla_cms-6.1.0/tests/test_page_relation_api.py +77 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/test_pages.py +137 -131
- django_camomilla_cms-6.1.0/tests/test_templates_context.py +149 -0
- django_camomilla_cms-6.1.0/tests/test_utils.py +56 -0
- django_camomilla_cms-6.0.0b18/PKG-INFO +0 -79
- django_camomilla_cms-6.0.0b18/README.md +0 -50
- django_camomilla_cms-6.0.0b18/camomilla/theme/__init__.py +0 -1
- django_camomilla_cms-6.0.0b18/camomilla/utils/templates.py +0 -33
- django_camomilla_cms-6.0.0b18/django_camomilla_cms.egg-info/PKG-INFO +0 -79
- django_camomilla_cms-6.0.0b18/tests/test_model_api.py +0 -68
- django_camomilla_cms-6.0.0b18/tests/test_templates_context.py +0 -111
- django_camomilla_cms-6.0.0b18/tests/test_utils.py +0 -86
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/LICENSE +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/MANIFEST.in +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/apps.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/authentication.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/context_processors.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/contrib/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/contrib/modeltranslation/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/contrib/modeltranslation/hvad_migration.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/defaults.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/dynamic_pages_urls.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/exceptions.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/fields/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/fields/json.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/management/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/management/commands/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/management/commands/regenerate_thumbnails.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/managers/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/managers/pages.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/model_api.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/models/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/models/article.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/models/content.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/models/media.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/models/menu.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/models/mixins/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/openapi/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/openapi/schema.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/parsers.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/permissions.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/redirects.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/article.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/content_type.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/fields/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/fields/file.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/fields/related.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/media.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/menu.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/mixins/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/mixins/fields.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/mixins/filter_fields.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/mixins/json.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/mixins/language.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/mixins/nesting.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/mixins/optimize.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/mixins/ordering.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/mixins/page.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/mixins/translation.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/user.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/utils.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/validators.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/sitemap.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/storages/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/storages/default.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/storages/optimize.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/storages/overwrite.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templates/admin/camomilla/page/change_form.html +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templates/defaults/articles/default.html +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templates/defaults/base.html +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templates/defaults/pages/default.html +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templates/defaults/parts/langswitch.html +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templates/defaults/parts/menu.html +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templates/defaults/widgets/media_select_multiple.html +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templates_context/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templates_context/autodiscover.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templates_context/rendering.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templatetags/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templatetags/camomilla_filters.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templatetags/menus.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/theme/admin/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/theme/admin/translations.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/theme/apps.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/theme/static/admin/css/responsive.css +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/theme/static/admin/img/favicon.ico +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/theme/static/admin/img/logo.svg +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/theme/templates/admin/base.html +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/theme/templates/rosetta/base.html +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/translation.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/utils/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/utils/getters.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/utils/normalization.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/utils/query_parser.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/utils/seo.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/utils/setters.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/utils/translation.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/articles.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/contents.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/decorators.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/languages.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/medias.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/mixins/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/mixins/bulk_actions.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/mixins/language.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/mixins/optimize.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/mixins/ordering.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/mixins/permissions.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/tags.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/users.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/django_camomilla_cms.egg-info/dependency_links.txt +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/django_camomilla_cms.egg-info/top_level.txt +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/setup.cfg +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/test_api.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/test_models.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/test_query_parser.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/utils/__init__.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/utils/api.py +0 -0
- {django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/tests/utils/media.py +0 -0
@@ -0,0 +1,133 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: django-camomilla-cms
|
3
|
+
Version: 6.1.0
|
4
|
+
Summary: Django powered cms
|
5
|
+
Author-email: Lotrèk <dimmitutto@lotrek.it>
|
6
|
+
License: MIT
|
7
|
+
Project-URL: Homepage, https://github.com/camomillacms/camomilla-core
|
8
|
+
Keywords: cms,django,api cms
|
9
|
+
Classifier: Environment :: Web Environment
|
10
|
+
Classifier: Framework :: Django
|
11
|
+
Classifier: Intended Audience :: Developers
|
12
|
+
Classifier: Programming Language :: Python
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
14
|
+
Requires-Python: <=3.13,>=3.8
|
15
|
+
Description-Content-Type: text/markdown
|
16
|
+
License-File: LICENSE
|
17
|
+
Requires-Dist: django-modeltranslation<=0.18.12,>=0.18.7
|
18
|
+
Requires-Dist: djsuperadmin<1.0.0,>=0.9
|
19
|
+
Requires-Dist: djangorestframework<=3.14.0,>=3.10.0
|
20
|
+
Requires-Dist: django-structured-json-field>=0.4.2
|
21
|
+
Requires-Dist: Pillow>=10.0.0
|
22
|
+
Requires-Dist: django-admin-interface<1.0.0,>=0.26.0
|
23
|
+
Requires-Dist: django-ckeditor<7.0.0,>=5.7.1
|
24
|
+
Requires-Dist: django-tinymce<5.0.0,>=4.1.0
|
25
|
+
Requires-Dist: python-magic<0.5,>=0.4
|
26
|
+
Requires-Dist: Django<6,>=3.2
|
27
|
+
Requires-Dist: django_jsonform>=2.23
|
28
|
+
Requires-Dist: inflection>=0.5.1
|
29
|
+
Requires-Dist: uritemplate>=4.1.0
|
30
|
+
Dynamic: license-file
|
31
|
+
|
32
|
+
[](https://pypi.org/project/django-camomilla-cms)
|
33
|
+
[](https://www.djangoproject.com/)
|
34
|
+
[](https://github.com/camomillacms/camomilla-core/actions)
|
35
|
+
[](https://github.com/camomillacms/camomilla-core/commits/master)
|
36
|
+
[](https://github.com/camomillacms/camomilla-core/graphs/contributors)
|
37
|
+
[](https://github.com/camomillacms/camomilla-core/issues)
|
38
|
+
[](https://app.codecov.io/gh/camomillacms/camomilla-core/tree/master/camomilla)
|
39
|
+
[](./LICENSE)
|
40
|
+
|
41
|
+
|
42
|
+
<br>
|
43
|
+
<br>
|
44
|
+
<br>
|
45
|
+
<br>
|
46
|
+
<div align="center">
|
47
|
+
<picture>
|
48
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://camomillacms.github.io/camomilla-core/images/camomilla-logo-dark.svg?v=1">
|
49
|
+
<source media="(prefers-color-scheme: light)" srcset="https://camomillacms.github.io/camomilla-core/images/camomilla-logo-light.svg?v=1">
|
50
|
+
<img alt="Fallback image description" src="https://camomillacms.github.io/camomilla-core/images/camomilla-logo-light.svg?v=1" style="width: 250px; height: auto;">
|
51
|
+
</picture>
|
52
|
+
</div>
|
53
|
+
<h3 align="center"">Our beloved Django CMS</h3>
|
54
|
+
<br>
|
55
|
+
|
56
|
+
## ⭐️ Features
|
57
|
+
|
58
|
+
<!-- Highlight some of the features your module provide here -->
|
59
|
+
|
60
|
+
- 🧘♀️ Built on top of the django framework
|
61
|
+
- 🥨 Beaked page abstract model to let you manage everything you need as a page.
|
62
|
+
- 🏞️ Optimized media management with autoresize
|
63
|
+
- 👯 Enable relations inside django JSONFields
|
64
|
+
- ⚡️ AutoCreate api endpoints from models
|
65
|
+
- 🚧 Enable JsonSchema directly in models endpoints
|
66
|
+
|
67
|
+
Camomilla is a Django CMS that allows you to create and manage your website's content with ease. It provides a simple and intuitive interface for managing pages, media, and other content types. Camomilla is built on top of the Django framework, which means it inherits all the features and benefits of Django framework.
|
68
|
+
We try to continuously improve Camomilla by adding new features and fixing bugs. You can check the [CHANGELOG](./CHANGELOG.md) to see what has been added in the latest releases.
|
69
|
+
|
70
|
+
## 📦 Quick Start
|
71
|
+
|
72
|
+
Here you can find some quick setup instructions to get started with Camomilla. For more detailed information, please refer to the [documentation](https://camomillacms.github.io/camomilla-core/).
|
73
|
+
|
74
|
+
> [!TIP]
|
75
|
+
>
|
76
|
+
> #### Env Virtualization 👾
|
77
|
+
>
|
78
|
+
> Use a virtualenv to isolate your project's dependencies from the system's python installation before starting. Check out [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) for more information.
|
79
|
+
|
80
|
+
Install django-camomilla-cms and django from pip
|
81
|
+
|
82
|
+
```bash
|
83
|
+
$ pip install django
|
84
|
+
$ pip install django-camomilla-cms==6.0.0
|
85
|
+
```
|
86
|
+
|
87
|
+
Create a new django project
|
88
|
+
|
89
|
+
```bash
|
90
|
+
$ django-admin startproject <project_name>
|
91
|
+
$ cd <project_name>
|
92
|
+
```
|
93
|
+
|
94
|
+
Create a dedicated folder for camomilla migrations
|
95
|
+
|
96
|
+
```bash
|
97
|
+
$ mkdir -p camomilla_migrations
|
98
|
+
$ touch camomilla_migrations.__init__.py
|
99
|
+
```
|
100
|
+
|
101
|
+
Create migrations and prepare the database
|
102
|
+
|
103
|
+
```bash
|
104
|
+
$ python manage.py makemigrations camomilla
|
105
|
+
$ python manage.py migrate
|
106
|
+
```
|
107
|
+
|
108
|
+
Add camomilla and camomilla dependencies to your project's INSTALLED_APPS
|
109
|
+
|
110
|
+
```python
|
111
|
+
# <project_name>/settings.py
|
112
|
+
|
113
|
+
INSTALLED_APPS = [
|
114
|
+
...
|
115
|
+
'camomilla', # always needed
|
116
|
+
'camomilla.theme', # needed to customize admin interface
|
117
|
+
'djsuperadmin', # needed if you whant to use djsuperadmin for contents
|
118
|
+
'modeltranslation', # needed if your website is multilanguage (can be added later)
|
119
|
+
'rest_framework', # always needed
|
120
|
+
'rest_framework.authtoken', # always needed
|
121
|
+
...
|
122
|
+
]
|
123
|
+
```
|
124
|
+
|
125
|
+
Run the server
|
126
|
+
|
127
|
+
```bash
|
128
|
+
$ python manage.py runserver
|
129
|
+
```
|
130
|
+
|
131
|
+
## 🧑💻 How to Contribute
|
132
|
+
|
133
|
+
We welcome contributions to Camomilla! If you want to contribute, please read our [contributing guide](./CONTRIBUTING.md) for more information on how to get started.
|
@@ -0,0 +1,102 @@
|
|
1
|
+
[](https://pypi.org/project/django-camomilla-cms)
|
2
|
+
[](https://www.djangoproject.com/)
|
3
|
+
[](https://github.com/camomillacms/camomilla-core/actions)
|
4
|
+
[](https://github.com/camomillacms/camomilla-core/commits/master)
|
5
|
+
[](https://github.com/camomillacms/camomilla-core/graphs/contributors)
|
6
|
+
[](https://github.com/camomillacms/camomilla-core/issues)
|
7
|
+
[](https://app.codecov.io/gh/camomillacms/camomilla-core/tree/master/camomilla)
|
8
|
+
[](./LICENSE)
|
9
|
+
|
10
|
+
|
11
|
+
<br>
|
12
|
+
<br>
|
13
|
+
<br>
|
14
|
+
<br>
|
15
|
+
<div align="center">
|
16
|
+
<picture>
|
17
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://camomillacms.github.io/camomilla-core/images/camomilla-logo-dark.svg?v=1">
|
18
|
+
<source media="(prefers-color-scheme: light)" srcset="https://camomillacms.github.io/camomilla-core/images/camomilla-logo-light.svg?v=1">
|
19
|
+
<img alt="Fallback image description" src="https://camomillacms.github.io/camomilla-core/images/camomilla-logo-light.svg?v=1" style="width: 250px; height: auto;">
|
20
|
+
</picture>
|
21
|
+
</div>
|
22
|
+
<h3 align="center"">Our beloved Django CMS</h3>
|
23
|
+
<br>
|
24
|
+
|
25
|
+
## ⭐️ Features
|
26
|
+
|
27
|
+
<!-- Highlight some of the features your module provide here -->
|
28
|
+
|
29
|
+
- 🧘♀️ Built on top of the django framework
|
30
|
+
- 🥨 Beaked page abstract model to let you manage everything you need as a page.
|
31
|
+
- 🏞️ Optimized media management with autoresize
|
32
|
+
- 👯 Enable relations inside django JSONFields
|
33
|
+
- ⚡️ AutoCreate api endpoints from models
|
34
|
+
- 🚧 Enable JsonSchema directly in models endpoints
|
35
|
+
|
36
|
+
Camomilla is a Django CMS that allows you to create and manage your website's content with ease. It provides a simple and intuitive interface for managing pages, media, and other content types. Camomilla is built on top of the Django framework, which means it inherits all the features and benefits of Django framework.
|
37
|
+
We try to continuously improve Camomilla by adding new features and fixing bugs. You can check the [CHANGELOG](./CHANGELOG.md) to see what has been added in the latest releases.
|
38
|
+
|
39
|
+
## 📦 Quick Start
|
40
|
+
|
41
|
+
Here you can find some quick setup instructions to get started with Camomilla. For more detailed information, please refer to the [documentation](https://camomillacms.github.io/camomilla-core/).
|
42
|
+
|
43
|
+
> [!TIP]
|
44
|
+
>
|
45
|
+
> #### Env Virtualization 👾
|
46
|
+
>
|
47
|
+
> Use a virtualenv to isolate your project's dependencies from the system's python installation before starting. Check out [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) for more information.
|
48
|
+
|
49
|
+
Install django-camomilla-cms and django from pip
|
50
|
+
|
51
|
+
```bash
|
52
|
+
$ pip install django
|
53
|
+
$ pip install django-camomilla-cms==6.0.0
|
54
|
+
```
|
55
|
+
|
56
|
+
Create a new django project
|
57
|
+
|
58
|
+
```bash
|
59
|
+
$ django-admin startproject <project_name>
|
60
|
+
$ cd <project_name>
|
61
|
+
```
|
62
|
+
|
63
|
+
Create a dedicated folder for camomilla migrations
|
64
|
+
|
65
|
+
```bash
|
66
|
+
$ mkdir -p camomilla_migrations
|
67
|
+
$ touch camomilla_migrations.__init__.py
|
68
|
+
```
|
69
|
+
|
70
|
+
Create migrations and prepare the database
|
71
|
+
|
72
|
+
```bash
|
73
|
+
$ python manage.py makemigrations camomilla
|
74
|
+
$ python manage.py migrate
|
75
|
+
```
|
76
|
+
|
77
|
+
Add camomilla and camomilla dependencies to your project's INSTALLED_APPS
|
78
|
+
|
79
|
+
```python
|
80
|
+
# <project_name>/settings.py
|
81
|
+
|
82
|
+
INSTALLED_APPS = [
|
83
|
+
...
|
84
|
+
'camomilla', # always needed
|
85
|
+
'camomilla.theme', # needed to customize admin interface
|
86
|
+
'djsuperadmin', # needed if you whant to use djsuperadmin for contents
|
87
|
+
'modeltranslation', # needed if your website is multilanguage (can be added later)
|
88
|
+
'rest_framework', # always needed
|
89
|
+
'rest_framework.authtoken', # always needed
|
90
|
+
...
|
91
|
+
]
|
92
|
+
```
|
93
|
+
|
94
|
+
Run the server
|
95
|
+
|
96
|
+
```bash
|
97
|
+
$ python manage.py runserver
|
98
|
+
```
|
99
|
+
|
100
|
+
## 🧑💻 How to Contribute
|
101
|
+
|
102
|
+
We welcome contributions to Camomilla! If you want to contribute, please read our [contributing guide](./CONTRIBUTING.md) for more information on how to get started.
|
@@ -10,7 +10,6 @@ from django.http import Http404, HttpRequest
|
|
10
10
|
from django.shortcuts import redirect
|
11
11
|
from django.urls import NoReverseMatch, reverse
|
12
12
|
from django.utils import timezone
|
13
|
-
from django.utils.functional import lazy
|
14
13
|
from django.utils.text import slugify
|
15
14
|
from django.utils.translation import gettext_lazy as _
|
16
15
|
from django.utils.translation import get_language
|
@@ -24,17 +23,13 @@ from camomilla.utils import (
|
|
24
23
|
lang_fallback_query,
|
25
24
|
set_nofallbacks,
|
26
25
|
url_lang_decompose,
|
27
|
-
get_all_templates_files,
|
28
26
|
)
|
29
27
|
from camomilla.utils.getters import pointed_getter
|
30
28
|
from camomilla import settings
|
31
29
|
from camomilla.templates_context.rendering import ctx_registry
|
32
30
|
from django.conf import settings as django_settings
|
33
31
|
from modeltranslation.utils import build_localized_fieldname
|
34
|
-
|
35
|
-
|
36
|
-
def GET_TEMPLATE_CHOICES():
|
37
|
-
return [(t, t) for t in get_all_templates_files()]
|
32
|
+
from django.utils.module_loading import import_string
|
38
33
|
|
39
34
|
|
40
35
|
class UrlRedirect(models.Model):
|
@@ -233,7 +228,7 @@ class AbstractPage(SeoMixin, MetaMixin, models.Model, metaclass=PageBase):
|
|
233
228
|
date_created = models.DateTimeField(auto_now_add=True)
|
234
229
|
date_updated_at = models.DateTimeField(auto_now=True)
|
235
230
|
breadcrumbs_title = models.CharField(max_length=128, null=True, blank=True)
|
236
|
-
template = models.CharField(max_length=500, null=True, blank=True
|
231
|
+
template = models.CharField(max_length=500, null=True, blank=True)
|
237
232
|
template_data = models.JSONField(default=dict, null=False, blank=True)
|
238
233
|
ordering = models.PositiveIntegerField(default=0, blank=False, null=False)
|
239
234
|
parent_page = models.ForeignKey(
|
@@ -276,7 +271,6 @@ class AbstractPage(SeoMixin, MetaMixin, models.Model, metaclass=PageBase):
|
|
276
271
|
|
277
272
|
def __init__(self, *args, **kwargs):
|
278
273
|
super(AbstractPage, self).__init__(*args, **kwargs)
|
279
|
-
self._meta.get_field("template").choices = lazy(GET_TEMPLATE_CHOICES, list)()
|
280
274
|
|
281
275
|
def __str__(self) -> str:
|
282
276
|
return "(%s) %s" % (self.__class__.__name__, self.title or self.permalink)
|
@@ -294,6 +288,22 @@ class AbstractPage(SeoMixin, MetaMixin, models.Model, metaclass=PageBase):
|
|
294
288
|
context.update(new_ctx)
|
295
289
|
return ctx_registry.get_context_for_page(self, request, super_ctx=context)
|
296
290
|
|
291
|
+
@classmethod
|
292
|
+
def get_serializer(cls):
|
293
|
+
from camomilla.serializers.mixins import AbstractPageMixin
|
294
|
+
|
295
|
+
standard_serializer = (
|
296
|
+
pointed_getter(cls, "_page_meta.standard_serializer")
|
297
|
+
or settings.PAGES_DEFAULT_SERIALIZER
|
298
|
+
)
|
299
|
+
if isinstance(standard_serializer, str):
|
300
|
+
standard_serializer = import_string(standard_serializer)
|
301
|
+
if not issubclass(standard_serializer, AbstractPageMixin):
|
302
|
+
raise ValueError(
|
303
|
+
f"Standard serializer {standard_serializer} must be a subclass of AbstractPageMixin"
|
304
|
+
)
|
305
|
+
return standard_serializer
|
306
|
+
|
297
307
|
@property
|
298
308
|
def model_name(self) -> str:
|
299
309
|
return self._meta.app_label + "." + self._meta.model_name
|
@@ -363,7 +373,8 @@ class AbstractPage(SeoMixin, MetaMixin, models.Model, metaclass=PageBase):
|
|
363
373
|
def generate_permalink(self, safe: bool = True) -> str:
|
364
374
|
permalink = f"/{slugify(self.title or '', allow_unicode=True)}"
|
365
375
|
if self.parent:
|
366
|
-
|
376
|
+
parent_permalink = (self.parent.permalink or "").lstrip("/")
|
377
|
+
permalink = f"/{parent_permalink}{permalink}"
|
367
378
|
set_nofallbacks(self, "permalink", permalink)
|
368
379
|
qs = UrlNode.objects.exclude(pk=getattr(self.url_node or object, "pk", None))
|
369
380
|
if safe and qs.filter(permalink=permalink).exists():
|
@@ -462,7 +473,7 @@ class AbstractPage(SeoMixin, MetaMixin, models.Model, metaclass=PageBase):
|
|
462
473
|
preview = request and getattr(request, "GET", {}).get("preview", False)
|
463
474
|
permalinks = get_field_translations(self.url_node or object, "permalink", None)
|
464
475
|
for lang in activate_languages():
|
465
|
-
if lang in permalinks:
|
476
|
+
if lang in permalinks and permalinks[lang]:
|
466
477
|
permalinks[lang] = (
|
467
478
|
UrlNode.reverse_url(permalinks[lang])
|
468
479
|
if preview or self.is_public
|
@@ -482,6 +493,7 @@ class AbstractPage(SeoMixin, MetaMixin, models.Model, metaclass=PageBase):
|
|
482
493
|
parent_page_field = "parent_page"
|
483
494
|
default_template = settings.PAGE_DEFAULT_TEMPLATE
|
484
495
|
inject_context_func = settings.PAGE_INJECT_CONTEXT_FUNC
|
496
|
+
standard_serializer = settings.PAGES_DEFAULT_SERIALIZER
|
485
497
|
|
486
498
|
|
487
499
|
class Page(AbstractPage):
|
{django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/serializers/base/__init__.py
RENAMED
@@ -9,18 +9,22 @@ from camomilla.serializers.mixins import (
|
|
9
9
|
FieldsOverrideMixin,
|
10
10
|
TranslationsMixin,
|
11
11
|
)
|
12
|
+
from camomilla.settings import ENABLE_TRANSLATIONS
|
12
13
|
|
13
|
-
|
14
|
-
class BaseModelSerializer(
|
14
|
+
bases = (
|
15
15
|
SetupEagerLoadingMixin,
|
16
16
|
NestMixin,
|
17
17
|
FilterFieldsMixin,
|
18
18
|
FieldsOverrideMixin,
|
19
19
|
JSONFieldPatchMixin,
|
20
20
|
OrderingMixin,
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
)
|
22
|
+
|
23
|
+
if ENABLE_TRANSLATIONS:
|
24
|
+
bases += (TranslationsMixin,)
|
25
|
+
|
26
|
+
|
27
|
+
class BaseModelSerializer(*bases, serializers.ModelSerializer):
|
24
28
|
"""
|
25
29
|
This is the base serializer for all the models.
|
26
30
|
It adds support for:
|
@@ -22,7 +22,7 @@ class PageSerializer(AbstractPageMixin, BaseModelSerializer):
|
|
22
22
|
fields = "__all__"
|
23
23
|
|
24
24
|
|
25
|
-
class
|
25
|
+
class UrlNodeSerializer(BaseModelSerializer):
|
26
26
|
is_public = serializers.SerializerMethodField()
|
27
27
|
status = serializers.SerializerMethodField()
|
28
28
|
indexable = serializers.SerializerMethodField()
|
@@ -41,17 +41,18 @@ class BasicUrlNodeSerializer(BaseModelSerializer):
|
|
41
41
|
return instance.page.indexable
|
42
42
|
|
43
43
|
|
44
|
-
class UrlNodeSerializer
|
44
|
+
class RouteSerializer(UrlNodeSerializer):
|
45
45
|
alternates = serializers.SerializerMethodField()
|
46
46
|
|
47
47
|
def get_alternates(self, instance: UrlNode):
|
48
48
|
return instance.page.alternate_urls()
|
49
49
|
|
50
50
|
def to_representation(self, instance: UrlNode):
|
51
|
+
standard_serializer = instance.page.get_serializer()
|
51
52
|
model_serializer = build_standard_model_serializer(
|
52
53
|
instance.page.__class__,
|
53
54
|
depth=10,
|
54
|
-
bases=(
|
55
|
+
bases=(standard_serializer,) + get_standard_bases(),
|
55
56
|
)
|
56
57
|
return {
|
57
58
|
**super().to_representation(instance),
|
@@ -49,6 +49,12 @@ PAGE_INJECT_CONTEXT_FUNC = pointed_getter(
|
|
49
49
|
django_settings, "CAMOMILLA.RENDER.PAGE.INJECT_CONTEXT", None
|
50
50
|
)
|
51
51
|
|
52
|
+
PAGES_DEFAULT_SERIALIZER = pointed_getter(
|
53
|
+
django_settings,
|
54
|
+
"CAMOMILLA.API.PAGES.DEFAULT_SERIALIZER",
|
55
|
+
"camomilla.serializers.mixins.AbstractPageMixin",
|
56
|
+
)
|
57
|
+
|
52
58
|
ENABLE_TRANSLATIONS = (
|
53
59
|
ENABLE_REGISTRATIONS and "modeltranslation" in django_settings.INSTALLED_APPS
|
54
60
|
)
|
@@ -88,8 +94,15 @@ API_TRANSLATION_ACCESSOR = pointed_getter(
|
|
88
94
|
)
|
89
95
|
|
90
96
|
REGISTERED_TEMPLATES_APPS = pointed_getter(
|
91
|
-
django_settings,
|
92
|
-
|
97
|
+
django_settings, "CAMOMILLA.RENDER.REGISTERED_TEMPLATES_APPS", None
|
98
|
+
)
|
99
|
+
|
100
|
+
INTEGRATIONS_ASTRO_ENABLE = pointed_getter(
|
101
|
+
django_settings, "CAMOMILLA.INTEGRATIONS.ASTRO.ENABLE", False
|
102
|
+
)
|
103
|
+
|
104
|
+
INTEGRATIONS_ASTRO_URL = pointed_getter(
|
105
|
+
django_settings, "CAMOMILLA.INTEGRATIONS.ASTRO.URL", ""
|
93
106
|
)
|
94
107
|
|
95
108
|
DEBUG = pointed_getter(django_settings, "CAMOMILLA.DEBUG", django_settings.DEBUG)
|
@@ -114,6 +127,12 @@ DEBUG = pointed_getter(django_settings, "CAMOMILLA.DEBUG", django_settings.DEBUG
|
|
114
127
|
# "STRUCTURED_FIELD": {
|
115
128
|
# "CACHE_ENABLED": True
|
116
129
|
# }
|
117
|
-
# "
|
130
|
+
# "INTEGRATIONS": {
|
131
|
+
# "ASTRO": {
|
132
|
+
# "ENABLE": True,
|
133
|
+
# "URL": "http://localhost:4321"
|
134
|
+
# }
|
135
|
+
# }
|
136
|
+
# "API": {"NESTING_DEPTH": 10, "TRANSLATION_ACCESSOR": "translations", "PAGES": {"DEFAULT_SERIALIZER": "camomilla.serializers.page.RouteSerializer"}},
|
118
137
|
# "DEBUG": False
|
119
138
|
# }
|
{django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/templatetags/model_extras.py
RENAMED
@@ -42,13 +42,17 @@ def pretty_dict(data, indent_level=0):
|
|
42
42
|
if isinstance(item, dict):
|
43
43
|
result.append(pretty_dict(item, indent_level + 1))
|
44
44
|
else:
|
45
|
-
result.append(
|
45
|
+
result.append(
|
46
|
+
f"{indent} {json.dumps(item, default=custom_json_serializer)},"
|
47
|
+
)
|
46
48
|
result.append(f"{indent}],")
|
47
49
|
|
48
50
|
else:
|
49
|
-
result.append(
|
51
|
+
result.append(
|
52
|
+
f"{indent}'{key}': {json.dumps(value, default=custom_json_serializer)},"
|
53
|
+
)
|
50
54
|
|
51
|
-
return "\n".join(result).rstrip(
|
55
|
+
return "\n".join(result).rstrip(",")
|
52
56
|
|
53
57
|
|
54
58
|
@register.filter
|
@@ -67,7 +71,7 @@ def to_pretty_dict(instance):
|
|
67
71
|
highlighted = re.sub(
|
68
72
|
r"(')([^&#]+?)('):",
|
69
73
|
r"<span style='color:#df3079'>'\2'</span>:",
|
70
|
-
escaped
|
74
|
+
escaped,
|
71
75
|
)
|
72
76
|
|
73
77
|
return mark_safe(f"<pre>{highlighted}</pre>")
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "6.1.0"
|
@@ -3,6 +3,8 @@ from camomilla import settings
|
|
3
3
|
from .translations import TranslationAwareModelAdmin
|
4
4
|
from camomilla.models import UrlNode
|
5
5
|
|
6
|
+
from camomilla.utils import get_templates
|
7
|
+
|
6
8
|
|
7
9
|
class AbstractPageModelFormMeta(forms.models.ModelFormMetaclass):
|
8
10
|
def __new__(mcs, name, bases, attrs):
|
@@ -22,6 +24,12 @@ class AbstractPageModelFormMeta(forms.models.ModelFormMetaclass):
|
|
22
24
|
class AbstractPageModelForm(
|
23
25
|
forms.models.BaseModelForm, metaclass=AbstractPageModelFormMeta
|
24
26
|
):
|
27
|
+
def __init__(self, *args, **kwargs):
|
28
|
+
request = kwargs.pop("request", None)
|
29
|
+
super().__init__(*args, **kwargs)
|
30
|
+
templates = [(t, t) for t in get_templates(request)]
|
31
|
+
templates.insert(0, ("", "---------"))
|
32
|
+
self.fields["template"] = forms.ChoiceField(choices=templates)
|
25
33
|
|
26
34
|
def get_initial_for_field(self, field, field_name):
|
27
35
|
if field_name in UrlNode.LANG_PERMALINK_FIELDS:
|
@@ -43,4 +51,16 @@ class AbstractPageModelForm(
|
|
43
51
|
|
44
52
|
class AbstractPageAdmin(TranslationAwareModelAdmin):
|
45
53
|
form = AbstractPageModelForm
|
54
|
+
|
55
|
+
def get_form(self, request, obj=None, **kwargs):
|
56
|
+
kwargs["form"] = self.form
|
57
|
+
form = super().get_form(request, obj, **kwargs)
|
58
|
+
|
59
|
+
class FormWithRequest(form):
|
60
|
+
def __new__(cls, *args, **kwargs_):
|
61
|
+
kwargs_["request"] = request
|
62
|
+
return form(*args, **kwargs_)
|
63
|
+
|
64
|
+
return FormWithRequest
|
65
|
+
|
46
66
|
change_form_template = "admin/camomilla/page/change_form.html"
|
@@ -19,7 +19,7 @@ from camomilla.views import (
|
|
19
19
|
UserViewSet,
|
20
20
|
MenuViewSet,
|
21
21
|
)
|
22
|
-
from camomilla.views.pages import
|
22
|
+
from camomilla.views.pages import pages_router
|
23
23
|
from camomilla.redirects import url_patterns as old_redirects
|
24
24
|
|
25
25
|
router = routers.DefaultRouter()
|
@@ -37,8 +37,8 @@ router.register(r"menus", MenuViewSet, "camomilla-menus")
|
|
37
37
|
urlpatterns = [
|
38
38
|
*old_redirects,
|
39
39
|
path("", include(router.urls)),
|
40
|
-
path("pages-router/",
|
41
|
-
path("pages-router/<path:permalink>",
|
40
|
+
path("pages-router/", pages_router),
|
41
|
+
path("pages-router/<path:permalink>", pages_router),
|
42
42
|
path("token-auth/", CamomillaObtainAuthToken.as_view(), name="api_token"),
|
43
43
|
path("auth/login/", CamomillaAuthLogin.as_view(), name="login"),
|
44
44
|
path("auth/logout/", CamomillaAuthLogout.as_view(), name="logout"),
|
@@ -0,0 +1,53 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
from typing import Sequence
|
3
|
+
import requests
|
4
|
+
|
5
|
+
from django import template as django_template
|
6
|
+
from os.path import relpath
|
7
|
+
from camomilla.settings import (
|
8
|
+
REGISTERED_TEMPLATES_APPS,
|
9
|
+
INTEGRATIONS_ASTRO_ENABLE,
|
10
|
+
INTEGRATIONS_ASTRO_URL,
|
11
|
+
)
|
12
|
+
|
13
|
+
|
14
|
+
def get_templates(request=None) -> Sequence[str]:
|
15
|
+
files = []
|
16
|
+
|
17
|
+
for engine in django_template.loader.engines.all():
|
18
|
+
|
19
|
+
if REGISTERED_TEMPLATES_APPS:
|
20
|
+
dirs = [
|
21
|
+
d
|
22
|
+
for d in engine.template_dirs
|
23
|
+
if any(app in str(d) for app in REGISTERED_TEMPLATES_APPS)
|
24
|
+
]
|
25
|
+
else:
|
26
|
+
# Exclude pip installed site package template dirs
|
27
|
+
dirs = [
|
28
|
+
d
|
29
|
+
for d in engine.template_dirs
|
30
|
+
if "site-packages" not in str(d) or "camomilla" in str(d)
|
31
|
+
]
|
32
|
+
|
33
|
+
for d in dirs:
|
34
|
+
base = Path(d)
|
35
|
+
files.extend(relpath(f, d) for f in base.rglob("*.html"))
|
36
|
+
|
37
|
+
if INTEGRATIONS_ASTRO_ENABLE and request is not None:
|
38
|
+
try:
|
39
|
+
response = requests.get(
|
40
|
+
INTEGRATIONS_ASTRO_URL + "/api/templates",
|
41
|
+
cookies={
|
42
|
+
"sessionid": request.COOKIES.get("sessionid"),
|
43
|
+
"csrftoken": request.COOKIES.get("csrftoken"),
|
44
|
+
},
|
45
|
+
)
|
46
|
+
if response.status_code == 200:
|
47
|
+
astro_templates = response.json()
|
48
|
+
for template in astro_templates:
|
49
|
+
files.append(template)
|
50
|
+
except:
|
51
|
+
pass
|
52
|
+
|
53
|
+
return files
|
{django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/base/__init__.py
RENAMED
@@ -4,6 +4,8 @@ from ..mixins import (
|
|
4
4
|
OrderingMixin,
|
5
5
|
CamomillaBasePermissionMixin,
|
6
6
|
)
|
7
|
+
from camomilla.serializers.mixins import TranslationsMixin
|
8
|
+
from camomilla.utils.translation import plain_to_nest
|
7
9
|
from rest_framework import viewsets
|
8
10
|
from rest_framework.metadata import SimpleMetadata
|
9
11
|
from structured.contrib.restframework import StructuredJSONField
|
@@ -29,8 +31,8 @@ class BaseViewMetadata(SimpleMetadata):
|
|
29
31
|
|
30
32
|
def get_serializer_info(self, serializer):
|
31
33
|
info = super().get_serializer_info(serializer)
|
32
|
-
if
|
33
|
-
info.update(
|
34
|
+
if isinstance(serializer, TranslationsMixin) and serializer.is_translatable:
|
35
|
+
info.update(plain_to_nest(info, serializer.translation_fields))
|
34
36
|
return info
|
35
37
|
|
36
38
|
|
@@ -9,7 +9,7 @@ from camomilla.models import AbstractPage, Menu
|
|
9
9
|
from camomilla.models.page import UrlNode
|
10
10
|
from camomilla.permissions import CamomillaBasePermissions
|
11
11
|
from camomilla.serializers import ContentTypeSerializer, MenuSerializer
|
12
|
-
from camomilla.serializers.page import
|
12
|
+
from camomilla.serializers.page import UrlNodeSerializer
|
13
13
|
from camomilla.views.base import BaseModelViewset
|
14
14
|
from camomilla.views.decorators import active_lang
|
15
15
|
|
@@ -66,7 +66,12 @@ class MenuViewSet(BaseModelViewset):
|
|
66
66
|
raise Http404("No object matches the given query.")
|
67
67
|
return Response(
|
68
68
|
[
|
69
|
-
{
|
69
|
+
{
|
70
|
+
"id": obj.pk,
|
71
|
+
"name": str(obj),
|
72
|
+
"url_node_id": obj.url_node.pk,
|
73
|
+
"model": f"{content_type.app_label}.{content_type.model}",
|
74
|
+
}
|
70
75
|
for obj in content_type.model_class().objects.exclude(
|
71
76
|
url_node__isnull=True
|
72
77
|
)
|
@@ -78,4 +83,4 @@ class MenuViewSet(BaseModelViewset):
|
|
78
83
|
def search_urlnode(self, request, *args, **kwargs):
|
79
84
|
url_node = request.GET.get("q", "")
|
80
85
|
qs = UrlNode.objects.filter(permalink__icontains=url_node).order_by("permalink")
|
81
|
-
return Response(
|
86
|
+
return Response(UrlNodeSerializer(qs, many=True).data)
|
{django_camomilla_cms-6.0.0b18 → django_camomilla_cms-6.1.0}/camomilla/views/mixins/pagination.py
RENAMED
@@ -86,7 +86,7 @@ class PaginateStackMixin:
|
|
86
86
|
if "sqlite" in settings.DATABASES["default"]["ENGINE"]:
|
87
87
|
filter_statement = Q()
|
88
88
|
for field in search_fields:
|
89
|
-
filter_statement |= Q(**{field +
|
89
|
+
filter_statement |= Q(**{field + "__icontains": search_string})
|
90
90
|
return list_handler.filter(filter_statement)
|
91
91
|
else:
|
92
92
|
return list_handler.annotate(
|