habarico 7.2.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.
Files changed (89) hide show
  1. habarico-7.2.0/LICENSE +21 -0
  2. habarico-7.2.0/MANIFEST.in +4 -0
  3. habarico-7.2.0/PKG-INFO +140 -0
  4. habarico-7.2.0/README.md +83 -0
  5. habarico-7.2.0/pyproject.toml +69 -0
  6. habarico-7.2.0/setup.cfg +4 -0
  7. habarico-7.2.0/src/__init__.py +0 -0
  8. habarico-7.2.0/src/habarico/__init__.py +29 -0
  9. habarico-7.2.0/src/habarico/admin.py +703 -0
  10. habarico-7.2.0/src/habarico/apps.py +37 -0
  11. habarico-7.2.0/src/habarico/checks.py +54 -0
  12. habarico-7.2.0/src/habarico/compat.py +3 -0
  13. habarico-7.2.0/src/habarico/config.py +28 -0
  14. habarico-7.2.0/src/habarico/contrib/__init__.py +0 -0
  15. habarico-7.2.0/src/habarico/contrib/preferences/__init__.py +33 -0
  16. habarico-7.2.0/src/habarico/contrib/preferences/apps.py +13 -0
  17. habarico-7.2.0/src/habarico/contrib/preferences/base.py +59 -0
  18. habarico-7.2.0/src/habarico/contrib/preferences/exceptions.py +51 -0
  19. habarico-7.2.0/src/habarico/contrib/preferences/migrations/0001_initial.py +42 -0
  20. habarico-7.2.0/src/habarico/contrib/preferences/migrations/__init__.py +0 -0
  21. habarico-7.2.0/src/habarico/contrib/preferences/models.py +27 -0
  22. habarico-7.2.0/src/habarico/contrib/preferences/registry.py +355 -0
  23. habarico-7.2.0/src/habarico/contrib/preferences/schemas.py +131 -0
  24. habarico-7.2.0/src/habarico/contrib/preferences/serializers.py +7 -0
  25. habarico-7.2.0/src/habarico/contrib/preferences/settings.py +45 -0
  26. habarico-7.2.0/src/habarico/contrib/preferences/urls.py +25 -0
  27. habarico-7.2.0/src/habarico/contrib/preferences/views.py +93 -0
  28. habarico-7.2.0/src/habarico/export/__init__.py +14 -0
  29. habarico-7.2.0/src/habarico/export/config.py +110 -0
  30. habarico-7.2.0/src/habarico/export/generators.py +133 -0
  31. habarico-7.2.0/src/habarico/export/renderers.py +519 -0
  32. habarico-7.2.0/src/habarico/export/views.py +382 -0
  33. habarico-7.2.0/src/habarico/export/wiring.py +95 -0
  34. habarico-7.2.0/src/habarico/fast_resolve.py +51 -0
  35. habarico-7.2.0/src/habarico/filters/__init__.py +290 -0
  36. habarico-7.2.0/src/habarico/filters/filters.py +181 -0
  37. habarico-7.2.0/src/habarico/locale/cs/LC_MESSAGES/django.mo +0 -0
  38. habarico-7.2.0/src/habarico/locale/cs/LC_MESSAGES/django.po +112 -0
  39. habarico-7.2.0/src/habarico/locale/de/LC_MESSAGES/django.mo +0 -0
  40. habarico-7.2.0/src/habarico/locale/de/LC_MESSAGES/django.po +113 -0
  41. habarico-7.2.0/src/habarico/locale/es/LC_MESSAGES/django.mo +0 -0
  42. habarico-7.2.0/src/habarico/locale/es/LC_MESSAGES/django.po +113 -0
  43. habarico-7.2.0/src/habarico/locale/fr/LC_MESSAGES/django.mo +0 -0
  44. habarico-7.2.0/src/habarico/locale/fr/LC_MESSAGES/django.po +113 -0
  45. habarico-7.2.0/src/habarico/locale/it/LC_MESSAGES/django.mo +0 -0
  46. habarico-7.2.0/src/habarico/locale/it/LC_MESSAGES/django.po +113 -0
  47. habarico-7.2.0/src/habarico/locale/ja/LC_MESSAGES/django.mo +0 -0
  48. habarico-7.2.0/src/habarico/locale/ja/LC_MESSAGES/django.po +113 -0
  49. habarico-7.2.0/src/habarico/locale/nl/LC_MESSAGES/django.mo +0 -0
  50. habarico-7.2.0/src/habarico/locale/nl/LC_MESSAGES/django.po +113 -0
  51. habarico-7.2.0/src/habarico/locale/pl/LC_MESSAGES/django.mo +0 -0
  52. habarico-7.2.0/src/habarico/locale/pl/LC_MESSAGES/django.po +114 -0
  53. habarico-7.2.0/src/habarico/locale/pt/LC_MESSAGES/django.mo +0 -0
  54. habarico-7.2.0/src/habarico/locale/pt/LC_MESSAGES/django.po +113 -0
  55. habarico-7.2.0/src/habarico/locale/ro/LC_MESSAGES/django.mo +0 -0
  56. habarico-7.2.0/src/habarico/locale/ro/LC_MESSAGES/django.po +114 -0
  57. habarico-7.2.0/src/habarico/locale/sk/LC_MESSAGES/django.mo +0 -0
  58. habarico-7.2.0/src/habarico/locale/sk/LC_MESSAGES/django.po +113 -0
  59. habarico-7.2.0/src/habarico/locale/uk/LC_MESSAGES/django.mo +0 -0
  60. habarico-7.2.0/src/habarico/locale/uk/LC_MESSAGES/django.po +116 -0
  61. habarico-7.2.0/src/habarico/models/__init__.py +23 -0
  62. habarico-7.2.0/src/habarico/pagination.py +102 -0
  63. habarico-7.2.0/src/habarico/response.py +38 -0
  64. habarico-7.2.0/src/habarico/routers.py +107 -0
  65. habarico-7.2.0/src/habarico/schema/__init__.py +121 -0
  66. habarico-7.2.0/src/habarico/schema/actions.py +761 -0
  67. habarico-7.2.0/src/habarico/schema/base.py +226 -0
  68. habarico-7.2.0/src/habarico/schema/boxes.py +750 -0
  69. habarico-7.2.0/src/habarico/schema/fields.py +869 -0
  70. habarico-7.2.0/src/habarico/schema/generators.py +2398 -0
  71. habarico-7.2.0/src/habarico/schema/menu.py +168 -0
  72. habarico-7.2.0/src/habarico/schema/resource.py +147 -0
  73. habarico-7.2.0/src/habarico/schema/types.py +140 -0
  74. habarico-7.2.0/src/habarico/schema/views.py +182 -0
  75. habarico-7.2.0/src/habarico/serializers/__init__.py +502 -0
  76. habarico-7.2.0/src/habarico/serializers/fields.py +377 -0
  77. habarico-7.2.0/src/habarico/settings.py +226 -0
  78. habarico-7.2.0/src/habarico/site.py +128 -0
  79. habarico-7.2.0/src/habarico/utils.py +651 -0
  80. habarico-7.2.0/src/habarico/validation.py +550 -0
  81. habarico-7.2.0/src/habarico/validators/__init__.py +4 -0
  82. habarico-7.2.0/src/habarico/validators/content_types.py +52 -0
  83. habarico-7.2.0/src/habarico/validators/files.py +88 -0
  84. habarico-7.2.0/src/habarico/views.py +282 -0
  85. habarico-7.2.0/src/habarico.egg-info/PKG-INFO +140 -0
  86. habarico-7.2.0/src/habarico.egg-info/SOURCES.txt +87 -0
  87. habarico-7.2.0/src/habarico.egg-info/dependency_links.txt +1 -0
  88. habarico-7.2.0/src/habarico.egg-info/requires.txt +13 -0
  89. habarico-7.2.0/src/habarico.egg-info/top_level.txt +2 -0
habarico-7.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Eluvia.land s.r.o.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include README.md
2
+ include LICENSE
3
+ include MANIFEST.in
4
+ recursive-include src *.py *.txt *.html *.po *.mo *.xml *.xslt *.xsl *.js *.sass *.css *.png *.jpg *.jpeg *.gif
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: habarico
3
+ Version: 7.2.0
4
+ Summary: Habarico REST admin Django library
5
+ Author-email: Luboš Mátl <lubos.matl@eluvia.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 Eluvia.land s.r.o.
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Documentation, https://docs.habarico.com/python/intro
29
+ Project-URL: Source Code, https://github.com/eluvia-com/habarico
30
+ Project-URL: Changelog, https://github.com/eluvia-com/habarico/blob/master/python/CHANGELOG.md
31
+ Keywords: package,django,admin,eluvia,habarico
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: Topic :: Software Development :: Libraries
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.10
37
+ Classifier: Programming Language :: Python :: 3.11
38
+ Classifier: Programming Language :: Python :: 3 :: Only
39
+ Classifier: License :: OSI Approved :: MIT License
40
+ Classifier: Operating System :: OS Independent
41
+ Requires-Python: >=3.10
42
+ Description-Content-Type: text/markdown
43
+ License-File: LICENSE
44
+ Requires-Dist: eluvia-base>=2.0.0
45
+ Requires-Dist: eluvia-base-django>=2.3.2
46
+ Requires-Dist: djangorestframework>=3.14
47
+ Requires-Dist: django>=3.0.0
48
+ Requires-Dist: django-filter>=23.1
49
+ Requires-Dist: django-phonenumber-field[phonenumbers]>=7.1.0
50
+ Requires-Dist: python-dateutil>=2.9.0
51
+ Requires-Dist: drf-extra-fields>=3.4.0
52
+ Requires-Dist: jsonschema>=4.0.0
53
+ Requires-Dist: pydantic<3,>=2
54
+ Provides-Extra: export-xlsx
55
+ Requires-Dist: openpyxl>=3.1; extra == "export-xlsx"
56
+ Dynamic: license-file
57
+
58
+ # habarico
59
+
60
+ Habarico is a schema-driven admin library for Django REST Framework. It turns Django models into a
61
+ complete admin API: REST endpoints plus JSON schemas describing resources, fields, views and
62
+ actions. The [React frontend](https://docs.habarico.com/node/intro) renders the whole admin UI from
63
+ those schemas — no screen is written per resource.
64
+
65
+ ## Installation
66
+
67
+ ```bash
68
+ pip install habarico
69
+ ```
70
+
71
+ Add the app to `INSTALLED_APPS`:
72
+
73
+ ```python
74
+ INSTALLED_APPS = [
75
+ ...,
76
+ "phonenumber_field", # required for phone number field localization
77
+ "habarico",
78
+ "rest_framework", # after habarico, which overrides its localization
79
+ ...
80
+ ]
81
+ ```
82
+
83
+ And mount the admin site in `urls.py`:
84
+
85
+ ```python
86
+ from django.urls import include, path
87
+ from habarico import site
88
+
89
+ urlpatterns = [
90
+ path("admin/", include(site.urls)),
91
+ ]
92
+ ```
93
+
94
+ ## Quick start
95
+
96
+ ```python
97
+ # admin.py
98
+ from habarico import ModelAdmin
99
+
100
+ from .models import Product
101
+
102
+
103
+ class ProductAdmin(ModelAdmin):
104
+ model = Product
105
+ fields = ["name", "sku", "description", "status", "category", "price", "stock"]
106
+ read_only_fields = ["created_at"]
107
+ search_fields = ["name", "description"]
108
+ filter_fields = ["status", "category", "price"]
109
+ ordering_fields = ["name", "price"]
110
+ can_create = True
111
+ can_update = True
112
+ ```
113
+
114
+ Importing the module registers the admin — that is a full CRUD resource: a list with filters and
115
+ sorting, a detail page, a create and an edit form.
116
+
117
+ ## Documentation
118
+
119
+ Full documentation is at **[docs.habarico.com/python](https://docs.habarico.com/python/intro)** —
120
+ this file is only a quick start.
121
+
122
+ | Section | What it covers |
123
+ | --- | --- |
124
+ | [Installation](https://docs.habarico.com/python/installation) and [configuration](https://docs.habarico.com/python/configuration) | Settings, permissions and authentication classes |
125
+ | [Basic usage](https://docs.habarico.com/python/basic-usage/) | Fields, permissions, custom serializers and viewsets, configuration validation |
126
+ | [View generators](https://docs.habarico.com/python/view-generators/) | Shaping the list, detail and form views |
127
+ | [Filtering and searching](https://docs.habarico.com/python/filtering-and-searching/) | Filters, ordering and fulltext search |
128
+ | [Aggregations](https://docs.habarico.com/python/aggregations/) and [dashboard](https://docs.habarico.com/python/dashboard) | The `/aggregate` endpoint and the widgets built on it |
129
+ | [Chunked uploads](https://docs.habarico.com/python/chunked-uploads/) | Large files over TUS or S3 multipart |
130
+ | [AI integration](https://docs.habarico.com/python/ai-integration/) | Predictive fields and the assistant endpoints |
131
+ | [User preferences](https://docs.habarico.com/python/user-preferences/) | The per-user preference store the frontend syncs to |
132
+ | [Complete example](https://docs.habarico.com/python/complete-example) | One resource wired up end to end |
133
+
134
+ The frontend consuming these schemas is documented at
135
+ [docs.habarico.com/node](https://docs.habarico.com/node/intro), and the contract between them is
136
+ the [API reference](https://docs.habarico.com/api).
137
+
138
+ ## License
139
+
140
+ [MIT](LICENSE)
@@ -0,0 +1,83 @@
1
+ # habarico
2
+
3
+ Habarico is a schema-driven admin library for Django REST Framework. It turns Django models into a
4
+ complete admin API: REST endpoints plus JSON schemas describing resources, fields, views and
5
+ actions. The [React frontend](https://docs.habarico.com/node/intro) renders the whole admin UI from
6
+ those schemas — no screen is written per resource.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ pip install habarico
12
+ ```
13
+
14
+ Add the app to `INSTALLED_APPS`:
15
+
16
+ ```python
17
+ INSTALLED_APPS = [
18
+ ...,
19
+ "phonenumber_field", # required for phone number field localization
20
+ "habarico",
21
+ "rest_framework", # after habarico, which overrides its localization
22
+ ...
23
+ ]
24
+ ```
25
+
26
+ And mount the admin site in `urls.py`:
27
+
28
+ ```python
29
+ from django.urls import include, path
30
+ from habarico import site
31
+
32
+ urlpatterns = [
33
+ path("admin/", include(site.urls)),
34
+ ]
35
+ ```
36
+
37
+ ## Quick start
38
+
39
+ ```python
40
+ # admin.py
41
+ from habarico import ModelAdmin
42
+
43
+ from .models import Product
44
+
45
+
46
+ class ProductAdmin(ModelAdmin):
47
+ model = Product
48
+ fields = ["name", "sku", "description", "status", "category", "price", "stock"]
49
+ read_only_fields = ["created_at"]
50
+ search_fields = ["name", "description"]
51
+ filter_fields = ["status", "category", "price"]
52
+ ordering_fields = ["name", "price"]
53
+ can_create = True
54
+ can_update = True
55
+ ```
56
+
57
+ Importing the module registers the admin — that is a full CRUD resource: a list with filters and
58
+ sorting, a detail page, a create and an edit form.
59
+
60
+ ## Documentation
61
+
62
+ Full documentation is at **[docs.habarico.com/python](https://docs.habarico.com/python/intro)** —
63
+ this file is only a quick start.
64
+
65
+ | Section | What it covers |
66
+ | --- | --- |
67
+ | [Installation](https://docs.habarico.com/python/installation) and [configuration](https://docs.habarico.com/python/configuration) | Settings, permissions and authentication classes |
68
+ | [Basic usage](https://docs.habarico.com/python/basic-usage/) | Fields, permissions, custom serializers and viewsets, configuration validation |
69
+ | [View generators](https://docs.habarico.com/python/view-generators/) | Shaping the list, detail and form views |
70
+ | [Filtering and searching](https://docs.habarico.com/python/filtering-and-searching/) | Filters, ordering and fulltext search |
71
+ | [Aggregations](https://docs.habarico.com/python/aggregations/) and [dashboard](https://docs.habarico.com/python/dashboard) | The `/aggregate` endpoint and the widgets built on it |
72
+ | [Chunked uploads](https://docs.habarico.com/python/chunked-uploads/) | Large files over TUS or S3 multipart |
73
+ | [AI integration](https://docs.habarico.com/python/ai-integration/) | Predictive fields and the assistant endpoints |
74
+ | [User preferences](https://docs.habarico.com/python/user-preferences/) | The per-user preference store the frontend syncs to |
75
+ | [Complete example](https://docs.habarico.com/python/complete-example) | One resource wired up end to end |
76
+
77
+ The frontend consuming these schemas is documented at
78
+ [docs.habarico.com/node](https://docs.habarico.com/node/intro), and the contract between them is
79
+ the [API reference](https://docs.habarico.com/api).
80
+
81
+ ## License
82
+
83
+ [MIT](LICENSE)
@@ -0,0 +1,69 @@
1
+ [project]
2
+ name = "habarico"
3
+ version = "7.2.0"
4
+ description = "Habarico REST admin Django library"
5
+ keywords = [
6
+ "package",
7
+ "django",
8
+ "admin",
9
+ "eluvia",
10
+ "habarico",
11
+ ]
12
+ dependencies = [
13
+ "eluvia-base>=2.0.0",
14
+ "eluvia-base-django>=2.3.2",
15
+ "djangorestframework>=3.14",
16
+ "django>=3.0.0",
17
+ "django-filter>=23.1",
18
+ "django-phonenumber-field[phonenumbers]>=7.1.0",
19
+ "python-dateutil>=2.9.0",
20
+ "drf-extra-fields>=3.4.0",
21
+ "jsonschema>=4.0.0",
22
+ "pydantic>=2,<3",
23
+ ]
24
+ readme = "README.md"
25
+ requires-python = ">=3.10"
26
+ classifiers = [
27
+ "Development Status :: 3 - Alpha",
28
+ "Intended Audience :: Developers",
29
+ "Topic :: Software Development :: Libraries",
30
+ "Programming Language :: Python :: 3",
31
+ "Programming Language :: Python :: 3.10",
32
+ "Programming Language :: Python :: 3.11",
33
+ "Programming Language :: Python :: 3 :: Only",
34
+ "License :: OSI Approved :: MIT License",
35
+ "Operating System :: OS Independent",
36
+ ]
37
+ [[project.authors]]
38
+ name = "Luboš Mátl"
39
+ email = "lubos.matl@eluvia.com"
40
+
41
+ [project.optional-dependencies]
42
+ export-xlsx = [
43
+ "openpyxl>=3.1",
44
+ ]
45
+
46
+ [project.license]
47
+ file = "LICENSE"
48
+
49
+ [project.urls]
50
+ Documentation = "https://docs.habarico.com/python/intro"
51
+ "Source Code" = "https://github.com/eluvia-com/habarico"
52
+ Changelog = "https://github.com/eluvia-com/habarico/blob/master/python/CHANGELOG.md"
53
+
54
+ [tool.black]
55
+ line-length = 120
56
+ target-version = [
57
+ "py310",
58
+ ]
59
+
60
+ [tool.flake8]
61
+ max-line-length = 120
62
+ ignore = "E203,W503"
63
+
64
+ [tool.isort]
65
+ profile = "black"
66
+ line_length = 120
67
+ known_third_party = [
68
+ "habarico",
69
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,29 @@
1
+ from django.utils.translation import gettext_lazy as _
2
+ from django_filters.conf import DEFAULTS
3
+ from habarico.admin import Admin
4
+ from habarico.settings import admin_api_settings
5
+ from habarico.site import site
6
+
7
+ __all__ = [
8
+ "Admin",
9
+ "ModelAdmin",
10
+ "site",
11
+ ]
12
+
13
+
14
+ def __getattr__(name):
15
+ # Resolved lazily via DEFAULT_MODEL_ADMIN_CLASS (habarico.settings), on first attribute
16
+ # access - never as a module-level assignment. Django imports this package while iterating
17
+ # INSTALLED_APPS during AppConfig.create(), before apps.apps_ready is set, so an eager
18
+ # assignment here would force-import whatever dependency graph the configured class (core or
19
+ # a pro/enterprise override) pulls in at that moment - see HAB-852, where
20
+ # habarico_enterprise.admin.ModelAdmin's import chain reached DRF's schema machinery and
21
+ # crashed with AppRegistryNotReady. Admin and site stay eager imports above: Admin is shallow
22
+ # and core-only, and site.py itself defers building its DEFAULT_ADMIN_SITE_CLASS singleton the
23
+ # same way (see habarico.site._build_site) - importing the *module* here is cheap.
24
+ if name == "ModelAdmin":
25
+ return admin_api_settings.DEFAULT_MODEL_ADMIN_CLASS
26
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
27
+
28
+
29
+ DEFAULTS["VERBOSE_LOOKUPS"]["in"] = _("list")