django-spire 0.25.2__py3-none-any.whl → 0.26.0__py3-none-any.whl

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 (91) hide show
  1. django_spire/auth/templates/django_spire/auth/element/android_and_chrome_app_install_element.html +33 -0
  2. django_spire/auth/templates/django_spire/auth/element/ios_app_install_element.html +48 -0
  3. django_spire/auth/templates/django_spire/auth/page/auth_page.html +2 -1
  4. django_spire/auth/templates/django_spire/auth/page/login_page.html +2 -0
  5. django_spire/comment/mixins.py +3 -3
  6. django_spire/comment/templates/django_spire/comment/card/comment_list_card.html +8 -5
  7. django_spire/comment/templates/django_spire/comment/form/comment_form.html +3 -3
  8. django_spire/comment/templates/django_spire/comment/form/content/comment_form_content.html +1 -0
  9. django_spire/comment/templates/django_spire/comment/item/comment_item_ellipsis.html +12 -8
  10. django_spire/comment/views.py +8 -8
  11. django_spire/consts.py +1 -1
  12. django_spire/contrib/form/utils.py +3 -3
  13. django_spire/contrib/queryset/filter_tools.py +56 -14
  14. django_spire/contrib/queryset/mixins.py +24 -3
  15. django_spire/contrib/service/django_model_service.py +5 -6
  16. django_spire/core/management/commands/spire_startapp.py +42 -25
  17. django_spire/core/management/commands/spire_startapp_pkg/exceptions.py +5 -0
  18. django_spire/core/management/commands/spire_startapp_pkg/maps.py +64 -32
  19. django_spire/core/management/commands/spire_startapp_pkg/template/app/constants.py.template +1 -0
  20. django_spire/core/management/commands/spire_startapp_pkg/template/app/forms.py.template +4 -0
  21. django_spire/core/management/commands/spire_startapp_pkg/template/app/models.py.template +2 -1
  22. django_spire/core/management/commands/spire_startapp_pkg/template/app/querysets.py.template +15 -6
  23. django_spire/core/management/commands/spire_startapp_pkg/template/app/urls/__init__.py.template +1 -0
  24. django_spire/core/management/commands/spire_startapp_pkg/template/app/urls/form_urls.py.template +6 -6
  25. django_spire/core/management/commands/spire_startapp_pkg/template/app/urls/page_urls.py.template +2 -2
  26. django_spire/core/management/commands/spire_startapp_pkg/template/app/urls/template_urls.py.template +12 -0
  27. django_spire/core/management/commands/spire_startapp_pkg/template/app/views/form_views.py.template +10 -11
  28. django_spire/core/management/commands/spire_startapp_pkg/template/app/views/page_views.py.template +17 -3
  29. django_spire/core/management/commands/spire_startapp_pkg/template/app/views/template_views.py.template +40 -0
  30. django_spire/core/management/commands/spire_startapp_pkg/template/templates/card/${form_card_template_name}.html.template +1 -1
  31. django_spire/core/management/commands/spire_startapp_pkg/template/templates/card/${list_base_card_template_name}.html.template +16 -0
  32. django_spire/core/management/commands/spire_startapp_pkg/template/templates/card/${list_items_card_template_name}.html.template +16 -0
  33. django_spire/core/management/commands/spire_startapp_pkg/template/templates/card/${list_table_card_template_name}.html.template +16 -0
  34. django_spire/core/management/commands/spire_startapp_pkg/template/templates/container/${list_container_template_name}.html.template +1 -0
  35. django_spire/core/management/commands/spire_startapp_pkg/template/templates/form/${list_filter_form_template_name}.html.template +30 -0
  36. django_spire/core/management/commands/spire_startapp_pkg/template/templates/item/${item_template_name}.html.template +32 -20
  37. django_spire/core/management/commands/spire_startapp_pkg/template/templates/item/${list_items_template_name}.html.template +3 -0
  38. django_spire/core/management/commands/spire_startapp_pkg/template/templates/page/${detail_page_template_name}.html.template +3 -3
  39. django_spire/core/management/commands/spire_startapp_pkg/template/templates/page/${form_page_template_name}.html.template +2 -2
  40. django_spire/core/management/commands/spire_startapp_pkg/template/templates/page/${list_page_template_name}.html.template +2 -2
  41. django_spire/core/management/commands/spire_startapp_pkg/template/templates/table/${table_row_template_name}.html.template +6 -0
  42. django_spire/core/management/commands/spire_startapp_pkg/template/templates/table/${table_rows_template_name}.html.template +3 -0
  43. django_spire/core/management/commands/spire_startapp_pkg/template/templates/table/${table_template_name}.html.template +6 -0
  44. django_spire/core/management/commands/spire_startapp_pkg/user_input.py +82 -9
  45. django_spire/core/management/commands/spire_startapp_pkg/validator.py +19 -6
  46. django_spire/core/querysets.py +19 -0
  47. django_spire/core/templates/django_spire/badge/base_badge.html +2 -3
  48. django_spire/core/templates/django_spire/base/base.html +1 -0
  49. django_spire/core/templates/django_spire/button/base_button.html +2 -1
  50. django_spire/core/templates/django_spire/card/title_card.html +13 -10
  51. django_spire/core/templates/django_spire/container/container.html +1 -1
  52. django_spire/core/templates/django_spire/filtering/form/base_session_filter_form.html +1 -1
  53. django_spire/core/templates/django_spire/form/field/_base_file_field.html +216 -0
  54. django_spire/core/templates/django_spire/form/field/_multi_checkbox_field.html +52 -0
  55. django_spire/core/templates/django_spire/form/field/base_field.html +128 -0
  56. django_spire/core/templates/django_spire/form/field/char_field.html +1 -0
  57. django_spire/core/templates/django_spire/form/field/color_field.html +1 -0
  58. django_spire/core/templates/django_spire/form/field/date_field.html +1 -0
  59. django_spire/core/templates/django_spire/form/field/datetime_field.html +1 -0
  60. django_spire/core/templates/django_spire/form/field/decimal_field.html +1 -0
  61. django_spire/core/templates/django_spire/form/field/element/select_checkmark_element.html +4 -0
  62. django_spire/core/templates/django_spire/form/field/element/select_down_arrow_element.html +5 -0
  63. django_spire/core/templates/django_spire/form/field/email_field.html +1 -0
  64. django_spire/core/templates/django_spire/form/field/input_field.html +13 -0
  65. django_spire/core/templates/django_spire/form/field/item/select_choice_item.html +15 -0
  66. django_spire/core/templates/django_spire/form/field/item/selected_choice_item.html +5 -0
  67. django_spire/core/templates/django_spire/form/field/list_field.html +112 -0
  68. django_spire/core/templates/django_spire/form/field/multi_file_field.html +90 -0
  69. django_spire/core/templates/django_spire/form/field/multi_select_field.html +155 -0
  70. django_spire/core/templates/django_spire/form/field/number_field.html +11 -0
  71. django_spire/core/templates/django_spire/form/field/password_field.html +1 -0
  72. django_spire/core/templates/django_spire/form/field/radio_field.html +24 -0
  73. django_spire/core/templates/django_spire/form/field/range_field.html +1 -0
  74. django_spire/core/templates/django_spire/form/field/search_and_select_field.html +119 -0
  75. django_spire/core/templates/django_spire/form/field/search_field.html +5 -0
  76. django_spire/core/templates/django_spire/form/field/select_field.html +78 -0
  77. django_spire/core/templates/django_spire/form/field/single_checkbox_field.html +27 -0
  78. django_spire/core/templates/django_spire/form/field/single_file_field.html +90 -0
  79. django_spire/core/templates/django_spire/form/field/telephone_field.html +1 -0
  80. django_spire/core/templates/django_spire/form/field/text_field.html +11 -0
  81. django_spire/core/templates/django_spire/form/field/time_field.html +1 -0
  82. django_spire/core/templates/django_spire/infinite_scroll/base.html +2 -1
  83. django_spire/core/templatetags/model_tags.py +34 -0
  84. django_spire/metric/report/tools.py +0 -2
  85. {django_spire-0.25.2.dist-info → django_spire-0.26.0.dist-info}/METADATA +1 -1
  86. {django_spire-0.25.2.dist-info → django_spire-0.26.0.dist-info}/RECORD +89 -45
  87. django_spire/core/management/commands/spire_startapp_pkg/template/app/tests/test_intelligence/__init__.py.template +0 -0
  88. django_spire/core/management/commands/spire_startapp_pkg/template/templates/card/${list_card_template_name}.html.template +0 -18
  89. {django_spire-0.25.2.dist-info → django_spire-0.26.0.dist-info}/WHEEL +0 -0
  90. {django_spire-0.25.2.dist-info → django_spire-0.26.0.dist-info}/licenses/LICENSE.md +0 -0
  91. {django_spire-0.25.2.dist-info → django_spire-0.26.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,119 @@
1
+ {% extends 'django_spire/form/field/base_field.html' %}
2
+
3
+ {% block field_content %}
4
+ <input
5
+ type="text"
6
+ x-model="value"
7
+ x-ref="glue_field"
8
+ hidden
9
+ >
10
+
11
+ <div
12
+ class="position-relative"
13
+ x-data="{
14
+ placeholder: '------------',
15
+ show_dropdown: false,
16
+ search: '',
17
+ is_search_focused: false,
18
+ choice_verbose: this.placeholder,
19
+
20
+ init() {
21
+ this.update_choice();
22
+
23
+ $watch('value', (value) => {
24
+ this.update_choice();
25
+ });
26
+
27
+ $watch('glue_field.choices', () => {
28
+ this.update_choice();
29
+ });
30
+ },
31
+
32
+ get filtered_choices() {
33
+ return glue_field.choices.filter(choice => {
34
+ let label = choice[1].toLowerCase();
35
+ let search = this.search.toLowerCase();
36
+ return label.includes(search);
37
+ });
38
+ },
39
+
40
+ focus_input() {
41
+ if (!is_touch_device()) {
42
+ this.$nextTick(() => {
43
+ if (this.show_dropdown) {
44
+ this.$refs.search_input.focus();
45
+ }
46
+ });
47
+ }
48
+ },
49
+
50
+ handle_click(event) {
51
+ if (!this.$refs.search_input.contains(event.target) && !this.is_search_focused || !this.is_search_focused && this.show_dropdown) {
52
+ this.show_dropdown = false;
53
+ }
54
+ },
55
+
56
+ select_choice(choice) {
57
+ this.value = choice[0];
58
+ this.search = '';
59
+ this.show_dropdown = false;
60
+ },
61
+
62
+ update_choice() {
63
+ let match = this.glue_field.choices.find(choice => String(choice[0]) === String(this.value));
64
+ this.choice_verbose = match ? match[1] : this.placeholder;
65
+ }
66
+ }"
67
+ @click.outside="handle_click"
68
+ >
69
+ <button
70
+ class="form-control text-start d-flex justify-content-between"
71
+ type="button"
72
+ style="outline: none; box-shadow: none;"
73
+ @click="$event.target.blur(); focus_input(); show_dropdown = !show_dropdown;"
74
+ >
75
+ <span x-text="choice_verbose"></span>
76
+
77
+ <span class="d-flex align-items-center">
78
+ {% include 'django_spire/form/field/element/select_down_arrow_element.html' %}
79
+ </span>
80
+ </button>
81
+
82
+ <div
83
+ x-show="show_dropdown"
84
+ class="shadow border rounded-2 mt-2 position-absolute z-3 bg-app-glue-layer-one w-100 p-0 list-group"
85
+ style="max-height: 300px; overflow-y: auto; z-index: 3;"
86
+ @keydown.escape="show_dropdown = false"
87
+ >
88
+ <div class="glue-fs--2 fw-bold ms-2 mt-1">
89
+ Select <span x-text="glue_field.label"></span>
90
+ </div>
91
+
92
+ <div class="m-2">
93
+ <input
94
+ x-model="search"
95
+ class="form-control glue-fs--2"
96
+ placeholder="Search..."
97
+ type="text"
98
+ x-ref="search_input"
99
+ @blur="setTimeout(() => is_search_focused = false, 150)"
100
+ @keydown.enter.prevent="select_choice(filtered_choices[0])"
101
+ >
102
+ </div>
103
+
104
+ <template x-for="(choice, index) in filtered_choices" :key="choice[0]">
105
+ <div
106
+ class="py-1 d-flex align-items-center list-group-item px-0"
107
+ tabindex="0"
108
+ @click="glue_field.disabled_choices.includes(choice[0]) ? '' : select_choice(choice)"
109
+ :class="glue_field.disabled_choices.includes(choice[0]) ? 'opacity-50 glue-user-select glue-cursor-not-allowed' : 'glue-cursor-pointer bg-app-glue-layer-one-hover'"
110
+ @keydown.enter.prevent="select_choice(choice)"
111
+ >
112
+ {% block choice_item %}
113
+ {% include 'django_spire/form/field/item/select_choice_item.html' %}
114
+ {% endblock %}
115
+ </div>
116
+ </template>
117
+ </div>
118
+ </div>
119
+ {% endblock %}
@@ -0,0 +1,5 @@
1
+ {% extends 'django_spire/form/field/input_field.html' %}
2
+
3
+ {% block input_type %}search{% endblock %}
4
+
5
+ {% block input_field_attrs %}placeholder="{% if search_field_placeholder %}{{ search_field_placeholder }}{% else %}Search...{% endif %}"{% endblock %}
@@ -0,0 +1,78 @@
1
+ {% extends 'django_spire/form/field/base_field.html' %}
2
+
3
+ {% block field_content %}
4
+ <input
5
+ type="text"
6
+ x-model="value"
7
+ x-ref="glue_field"
8
+ hidden
9
+ >
10
+
11
+ <div
12
+ class="position-relative"
13
+ x-data="{
14
+ placeholder: '------------',
15
+ show_dropdown: false,
16
+ choice_verbose: this.placeholder,
17
+
18
+ init() {
19
+ this.update_choice();
20
+
21
+ $watch('value', (value) => {
22
+ this.update_choice();
23
+ });
24
+
25
+ $watch('glue_field.choices', () => {
26
+ this.update_choice();
27
+ });
28
+ },
29
+
30
+ update_choice() {
31
+ let match = this.glue_field.choices.find(choice => String(choice[0]) === String(this.value));
32
+ this.choice_verbose = match ? match[1] : this.placeholder;
33
+ }
34
+ }"
35
+ x-effect="update_choice();"
36
+ >
37
+ <button
38
+ class="form-control text-start d-flex justify-content-between {{ select_padding }}"
39
+ type="button"
40
+ @click="show_dropdown = !show_dropdown"
41
+ >
42
+ <span x-text="choice_verbose"></span>
43
+
44
+ <span class="d-flex align-items-center pt-1">
45
+ {% include 'django_spire/form/field/element/select_down_arrow_element.html' %}
46
+ </span>
47
+ </button>
48
+ <div
49
+ x-cloak
50
+ x-show="show_dropdown"
51
+ @click.outside="show_dropdown = false"
52
+ class="shadow border rounded-2 mt-2 position-absolute z-3 bg-app-glue-layer-one w-100 p-0 list-group"
53
+ style="max-height: 300px; overflow-y: auto; z-index: 3;"
54
+ @keydown.escape="show_dropdown = false"
55
+ x-trap.inert="show_dropdown"
56
+ >
57
+ {% block select_dropdown_header %}
58
+ {% endblock %}
59
+
60
+ <template x-for="(choice, index) in glue_field.choices" :key="choice[0]">
61
+ <div
62
+ class="py-1 d-flex align-items-center list-group-item px-0"
63
+ tabindex="0"
64
+ @click="glue_field.disabled_choices.includes(choice[0]) ? '' : value = choice[0]; show_dropdown = false"
65
+ :class="glue_field.disabled_choices.includes(choice[0]) ? 'opacity-50 glue-user-select glue-cursor-not-allowed' : 'glue-cursor-pointer bg-app-glue-layer-one-hover'"
66
+ @keydown.enter.prevent="value = choice[0]; show_dropdown = false"
67
+ >
68
+ {% block choice_item %}
69
+ {% include 'django_spire/form/field/item/select_choice_item.html' %}
70
+ {% endblock %}
71
+ </div>
72
+ </template>
73
+
74
+ {% block select_dropdown_footer %}
75
+ {% endblock %}
76
+ </div>
77
+ </div>
78
+ {% endblock %}
@@ -0,0 +1,27 @@
1
+ {% extends 'django_spire/form/field/base_field.html' %}
2
+
3
+ {% block field_content %}
4
+ <div
5
+ class="glue-form-group"
6
+ x-init="glue_field.hide_label()"
7
+ >
8
+ <div>
9
+ <div class="d-flex align-items-center">
10
+ <input
11
+ type="checkbox"
12
+ class="glue-form-check-input me-2"
13
+ :id="glue_field.id"
14
+ :name="glue_field.name"
15
+ x-model="value"
16
+ x-ref="glue_field"
17
+ style="accent-color: var(--glue-primary);"
18
+ >
19
+ <label
20
+ class="glue-form-check-label glue-text-primary glue-cursor-pointer"
21
+ :for="glue_field.id"
22
+ x-text="glue_field.label"
23
+ ></label>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ {% endblock %}
@@ -0,0 +1,90 @@
1
+ {% extends 'django_spire/form/field/_base_file_field.html' %}
2
+
3
+ {% block x-data %}
4
+ async handle_files_change(event) {
5
+ let files = Array.from(event.target.files || []);
6
+ if (files.length === 0) return;
7
+
8
+ this.files = [];
9
+
10
+ Object.keys(this.objects).forEach(id => {
11
+ URL.revokeObjectURL(this.files.find(file => file.id === id)?.data);
12
+ URL.revokeObjectURL(this.files.find(file => file.id === id)?.preview);
13
+ });
14
+
15
+ this.objects = {};
16
+
17
+ let file = files[0];
18
+
19
+ if (file.size > this.maximum_filesize) {
20
+ alert(`The file is too large (${this.format_file_size(file.size)}). Maximum size is
21
+ ${this.format_file_size(this.maximum_filesize)}.`);
22
+ return;
23
+ }
24
+
25
+ let file_id = Date.now() + '-' + Math.random().toString(36).substr(2, 9);
26
+ let processed = file;
27
+
28
+ if (file.type.startsWith('image/') && file.type !== 'image/svg+xml' && this.compression) {
29
+ processed = await this.compress(file);
30
+ }
31
+
32
+ this.objects[file_id] = processed;
33
+
34
+ let data = URL.createObjectURL(processed);
35
+
36
+ this.files.push({
37
+ id: file_id,
38
+ name: processed.name,
39
+ size: processed.size,
40
+ type: processed.type,
41
+ data: data,
42
+ preview: processed.type.startsWith('image/') ? data : null
43
+ });
44
+
45
+ this.update_value();
46
+ this.show_dropdown = true;
47
+ this.update_form_files();
48
+
49
+ this.$refs.file_input.value = '';
50
+ this.$refs.camera_input.value = '';
51
+ },
52
+
53
+ remove_file(file_id) {
54
+ let file = this.files.find(file => file.id === file_id);
55
+
56
+ if (file) {
57
+ URL.revokeObjectURL(file.data);
58
+ if (file.preview) URL.revokeObjectURL(file.preview);
59
+ }
60
+
61
+ delete this.objects[file_id];
62
+
63
+ this.files = [];
64
+
65
+ this.update_value();
66
+ this.update_form_files();
67
+
68
+ if (this.files.length === 0) {
69
+ this.show_dropdown = false;
70
+ }
71
+ }
72
+ {% endblock %}
73
+
74
+ {% block upload_attributes %}{% endblock %}
75
+ {% block file_input_attributes %}{% endblock %}
76
+ {% block camera_input_attributes %}{% endblock %}
77
+
78
+ {% block selection_display %}
79
+ <template x-if="files.length === 0">
80
+ <span>No file selected</span>
81
+ </template>
82
+
83
+ <template x-if="files.length > 0">
84
+ <span x-text="truncate_name(files[0].name)"></span>
85
+ </template>
86
+ {% endblock %}
87
+
88
+ {% block drop_area_text %}
89
+ <span>Click to select or drag and drop a file here</span>
90
+ {% endblock %}
@@ -0,0 +1 @@
1
+ {% include 'django_spire/form/field/input_field.html' with input_type='tel' %}
@@ -0,0 +1,11 @@
1
+ {% extends 'django_spire/form/field/base_field.html' %}
2
+
3
+ {% block field_content %}
4
+ <textarea
5
+ x-ref="glue_field"
6
+ type="text"
7
+ class="form-control"
8
+ x-model.debounce.500ms="value"
9
+ rows="{% if rows %}{{ rows }}{% else %}3{% endif %}"
10
+ ></textarea>
11
+ {% endblock %}
@@ -0,0 +1 @@
1
+ {% include 'django_spire/form/field/input_field.html' with input_type='time' %}
@@ -322,7 +322,8 @@
322
322
  {% block scroll_container %}
323
323
  <div
324
324
  class="position-relative {% block scroll_container_class %}{% endblock %}"
325
- style="height: {{ container_height|default:'600px' }}; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;"
325
+ style="height:
326
+ {% block container_height %}{{ container_height|default:'600px' }}{% endblock %}; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;"
326
327
  x-ref="scroll_container"
327
328
  >
328
329
  {% block scroll_content_wrapper %}
@@ -0,0 +1,34 @@
1
+ from django import template
2
+ from django.db.models import Model
3
+
4
+ register = template.Library()
5
+
6
+
7
+ @register.filter
8
+ def model_app_label(model_obj: Model) -> str:
9
+ """
10
+ Return the Django app label for the given model instance.
11
+
12
+ Args:
13
+ model_obj: A Django model instance.
14
+
15
+ Returns:
16
+ The app label defined by the model's app configuration.
17
+ """
18
+
19
+ return model_obj._meta.app_label
20
+
21
+
22
+ @register.filter
23
+ def model_name(model_obj: Model) -> str:
24
+ """
25
+ Return the Django model name for the given model instance.
26
+
27
+ Args:
28
+ model_obj: A Django model instance.
29
+
30
+ Returns:
31
+ The model name (lowercased) as defined by Django's model metadata.
32
+ """
33
+
34
+ return model_obj._meta.model_name
@@ -1,5 +1,3 @@
1
- import datetime
2
-
3
1
  from django_spire.metric.report.enums import ColumnType
4
2
 
5
3
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: django-spire
3
- Version: 0.25.2
3
+ Version: 0.26.0
4
4
  Summary: A project for Django Spire
5
5
  Author-email: Brayden Carlson <braydenc@stratusadv.com>, Nathan Johnson <nathanj@stratusadv.com>
6
6
  License: Copyright (c) 2025 Stratus Advanced Technologies and Contributors.