Skip to content

Commit 376d12c

Browse files
stehlfi1xkubov
authored andcommitted
Documentation for cores added
1 parent 45df7fc commit 376d12c

File tree

4 files changed

+107
-13
lines changed

4 files changed

+107
-13
lines changed

is_core/contrib/background_export/cores.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77

88
class BackgroundExportCoreMixin:
9+
"""
10+
Mixin that adds background export functionality to cores.
11+
"""
912

1013
export_permission = IsSuperuser()
1114
rest_resource_class = CeleryDjangoCoreResource
@@ -20,11 +23,17 @@ def _init_permission(self, permission):
2023

2124

2225
class DjangoBackgroundExportUiRestCore(BackgroundExportCoreMixin, DjangoUiRestCore):
26+
"""
27+
Django core with background export functionality. Provides UI and REST with export capabilities.
28+
"""
2329

2430
abstract = True
2531

2632

2733
class BaseExportedFileCore(DjangoBackgroundExportUiRestCore):
34+
"""
35+
Base core for managing exported files
36+
"""
2837

2938
abstract = True
3039
model = ExportedFile

is_core/contrib/dynamo/cores.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010

1111
class DynamoCore(ModelCore):
12+
"""
13+
Base core for DynamoDB models. Provides queryset handling and object retrieval for DynamoDB documents.
14+
"""
1215

1316
abstract = True
1417

@@ -43,6 +46,9 @@ def _obj_name(self):
4346

4447

4548
class DynamoUiCore(DynamoCore, ModelUiCore):
49+
"""
50+
DynamoDB UI core. Provides UI views for DynamoDB documents with specialized table and detail views.
51+
"""
4652

4753
abstract = True
4854

@@ -51,6 +57,9 @@ class DynamoUiCore(DynamoCore, ModelUiCore):
5157

5258

5359
class DynamoRestCore(DynamoCore, ModelRestCore):
60+
"""
61+
DynamoDB REST core. Provides REST resources for DynamoDB documents with cursor-based pagination.
62+
"""
5463

5564
abstract = True
5665

@@ -59,5 +68,8 @@ class DynamoRestCore(DynamoCore, ModelRestCore):
5968

6069

6170
class DynamoUiRestCore(DynamoUiCore, DynamoRestCore, ModelUiRestCore):
71+
"""
72+
Combined DynamoDB UI and REST core. Provides both UI views and REST resources for DynamoDB documents.
73+
"""
6274

6375
abstract = True

is_core/contrib/elasticsearch/cores.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88

99
class ElasticsearchCore(ModelCore):
10+
"""
11+
Base core for Elasticsearch models. Provides queryset handling and menu group generation for Elasticsearch
12+
documents.
13+
"""
1014

1115
abstract = True
1216

@@ -23,6 +27,9 @@ def get_queryset(self, request):
2327

2428

2529
class ElasticsearchUiCore(ElasticsearchCore, ModelUiCore):
30+
"""
31+
Elasticsearch UI core. Provides UI views for Elasticsearch documents with specialized table and detail views.
32+
"""
2633

2734
abstract = True
2835

@@ -31,6 +38,10 @@ class ElasticsearchUiCore(ElasticsearchCore, ModelUiCore):
3138

3239

3340
class ElasticsearchRestCore(ElasticsearchCore, ModelRestCore):
41+
"""
42+
Elasticsearch REST core. Provides REST resources for Elasticsearch documents with specialized pagination
43+
and filtering.
44+
"""
3445

3546
abstract = True
3647

@@ -40,5 +51,8 @@ class ElasticsearchRestCore(ElasticsearchCore, ModelRestCore):
4051

4152

4253
class ElasticsearchUiRestCore(ElasticsearchRestCore, ElasticsearchUiCore, ModelUiRestCore):
54+
"""
55+
Combined Elasticsearch UI and REST core. Provides both UI views and REST resources for Elasticsearch documents.
56+
"""
4357

4458
abstract = True

is_core/main.py

Lines changed: 72 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ def __new__(cls, *args, **kwargs):
5353

5454
class Core(metaclass=CoreBase):
5555
"""
56-
Parent of all IS cores. Contains common methods for all cores.
57-
This class is abstract.
56+
Base class for all IS cores. Contains common methods for all cores.
57+
58+
Provides URL pattern generation, permission handling, and menu group management.
59+
Use this as a base for custom core implementations that don't work with models.
5860
"""
5961

6062
abstract = True
@@ -130,6 +132,12 @@ def get_verbose_name_plural(self):
130132

131133

132134
class ModelCore(GetMethodFieldMixin, Core):
135+
"""
136+
Base class for cores that work with models. Provides field management and queryset handling.
137+
138+
Defines methods for field configuration, ordering, and basic CRUD permissions.
139+
Use this as a base for custom model-based cores that need field management without UI or REST.
140+
"""
133141

134142
abstract = True
135143

@@ -172,8 +180,10 @@ def get_default_action(self, request, obj):
172180

173181
class DjangoCore(ModelCore):
174182
"""
175-
Parent of REST and UI cores that works as controller to specific model.
176-
This class is abstract.
183+
Django model controller that provides form handling and model lifecycle methods.
184+
185+
Handles form class selection, model saving/deleting operations, and verbose name management.
186+
Use this as a base for cores that need Django model integration with form handling.
177187
"""
178188

179189
abstract = True
@@ -237,7 +247,12 @@ def get_queryset(self, request):
237247

238248

239249
class UiCore(Core):
240-
"""Main core for UI views."""
250+
"""
251+
Core for UI views. Provides HTML template rendering views and menu integration.
252+
253+
Handles view class registration, menu item generation, and URL pattern management for UI views.
254+
Use this when you need only template rendering views without REST functionality.
255+
"""
241256

242257
abstract = True
243258

@@ -300,7 +315,12 @@ def menu_url(self, request):
300315

301316

302317
class RestCore(Core):
303-
"""Main core for REST views."""
318+
"""
319+
Core for REST views. Provides REST resources without HTML template rendering.
320+
321+
Handles REST resource registration, API URL generation, and REST pattern management.
322+
Use this when you need only REST API functionality without UI views.
323+
"""
304324

305325
rest_classes = ()
306326
default_rest_pattern_class = RestPattern
@@ -363,12 +383,23 @@ def get_urls(self):
363383

364384

365385
class UiRestCore(UiRestCoreMixin, UiCore, RestCore):
366-
"""UI REST Core, its main purpose is create custom REST resources and UI views."""
386+
"""
387+
Combined UI and REST core. Provides both HTML template rendering and REST resources.
388+
389+
Combines UiCore and RestCore functionality for applications that need both UI and REST endpoints.
390+
Use this when you need both UI views and REST API for custom functionality.
391+
"""
367392

368393
abstract = True
369394

370395

371396
class HomeUiCore(UiCore):
397+
"""
398+
Special core for home page functionality. Provides the main landing page view.
399+
400+
Creates the home/index view with custom URL routing. Automatically registered
401+
unless overridden by settings. Provides the root URL ('/') navigation.
402+
"""
372403

373404
menu_url_name = 'index'
374405
verbose_name_plural = _('Home')
@@ -388,6 +419,12 @@ def get_url_prefix(self):
388419

389420

390421
class ModelUiCore(ModelCore, UiCore):
422+
"""
423+
Model UI core base class. Combines model handling with UI view functionality.
424+
425+
Provides model-based UI views with fieldsets, inline views, and export capabilities.
426+
Base class for cores that need both model management and UI views.
427+
"""
391428

392429
abstract = True
393430

@@ -486,7 +523,12 @@ def _obj_name(self, obj):
486523

487524

488525
class DjangoUiCore(DjangoCore, ModelUiCore):
489-
"""Main core controller for specific model that provides UI views for model management (add, edit, list)."""
526+
"""
527+
Django model UI core. Provides default UI views (add, list, detail) for Django models.
528+
529+
Creates add, edit, and list views for Django models with form handling and template rendering.
530+
Use this when you need only UI views for Django model management without REST API.
531+
"""
490532

491533
abstract = True
492534

@@ -497,8 +539,10 @@ class DjangoUiCore(DjangoCore, ModelUiCore):
497539

498540
class ModelRestCore(RestCore, ModelCore):
499541
"""
500-
Main core controller for specific model that provides REST resources for model management.
501-
CRUD (POST, GET, PUT, DELETE).
542+
Model REST core. Provides REST resources for Django models without UI views.
543+
544+
Creates REST endpoints for model CRUD operations with filtering, pagination, and field management.
545+
Use this when you need only REST API for Django model management without UI views.
502546
"""
503547

504548
abstract = True
@@ -641,7 +685,11 @@ def _default_action(self, obj, request):
641685
class DjangoRestCore(ModelRestCore, DjangoCore):
642686
"""
643687
Main core controller for specific model that provides REST resources for model management.
644-
CRUD (POST, GET, PUT, DELETE).
688+
689+
Creates REST endpoints with full CRUD operations (POST, GET, PUT, DELETE), filtering, pagination,
690+
and field management for Django models. Integrates with Django model metadata for automatic
691+
field configuration.
692+
Use this when you need only REST API for Django model management without UI views.
645693
"""
646694

647695
abstract = True
@@ -693,6 +741,12 @@ def get_rest_order_fields(self, request):
693741

694742

695743
class ModelUiRestCore(UiRestCoreMixin, ModelRestCore, ModelUiCore):
744+
"""
745+
Model UI REST core base class. Combines model handling with both UI and REST functionality.
746+
747+
Provides model-based UI views and REST resources with integrated web links and actions.
748+
Base class for cores that need model management through both UI and REST interfaces.
749+
"""
696750

697751
abstract = True
698752

@@ -749,8 +803,13 @@ def _class_names(self, obj, request):
749803

750804
class DjangoUiRestCore(DjangoRestCore, DjangoUiCore, ModelUiRestCore):
751805
"""
752-
Combination of UI views and REST resources. UI views uses REST resources for printing model data, filtering,
753-
paging and so on.
806+
The main and recommended core for Django model management. Provides complete interface with both UI views
807+
and REST resources.
808+
809+
This is the default choice for most Django models. Creates a complete model management interface
810+
with UI views (add, edit, list) and REST API endpoints. UI views use REST resources for data
811+
operations, filtering, and pagination. Includes bulk operations and export functionality.
812+
Use this for standard Django model management - it provides everything you need out of the box.
754813
"""
755814

756815
abstract = True

0 commit comments

Comments
 (0)