accrete 0.0.142__py3-none-any.whl → 0.0.144__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 (40) hide show
  1. accrete/contrib/log/admin.py +1 -1
  2. accrete/contrib/system_mail/tasks.py +4 -5
  3. accrete/contrib/ui/__init__.py +16 -14
  4. accrete/contrib/ui/filter.py +22 -13
  5. accrete/contrib/ui/response.py +540 -0
  6. accrete/contrib/ui/static/css/accrete.css +69 -12
  7. accrete/contrib/ui/static/css/accrete.css.map +1 -1
  8. accrete/contrib/ui/static/css/accrete.scss +370 -300
  9. accrete/contrib/ui/templates/ui/content.html +0 -0
  10. accrete/contrib/ui/templates/ui/content_right.html +2 -2
  11. accrete/contrib/ui/templates/ui/detail.html +11 -0
  12. accrete/contrib/ui/templates/ui/filter/filter.html +5 -5
  13. accrete/contrib/ui/templates/ui/filter/query_tags.html +1 -1
  14. accrete/contrib/ui/templates/ui/form_error.html +1 -1
  15. accrete/contrib/ui/templates/ui/layout.html +69 -64
  16. accrete/contrib/ui/templates/ui/list.html +21 -19
  17. accrete/contrib/ui/templates/ui/list_update.html +9 -3
  18. accrete/contrib/ui/templates/ui/message.html +1 -1
  19. accrete/contrib/ui/templates/ui/modal.html +41 -32
  20. accrete/contrib/ui/templates/ui/table_row_update.html +2 -2
  21. accrete/contrib/ui/templates/ui/templatetags/field.html +19 -6
  22. accrete/contrib/ui/templates/ui/widgets/model_search_select.html +7 -7
  23. accrete/contrib/ui/templates/ui/widgets/model_search_select_multi.html +3 -3
  24. accrete/contrib/ui/templatetags/ui.py +24 -2
  25. accrete/contrib/user/templates/user/password_forgotten.html +1 -0
  26. accrete/contrib/user/templates/user/user_preferences.html +43 -0
  27. accrete/contrib/user/views.py +36 -37
  28. accrete/migrations/0008_alter_member_access_groups_and_more.py +23 -0
  29. accrete/utils/__init__.py +1 -0
  30. accrete/utils/forms.py +48 -28
  31. accrete/utils/views.py +1 -2
  32. accrete/views.py +2 -3
  33. {accrete-0.0.142.dist-info → accrete-0.0.144.dist-info}/METADATA +2 -2
  34. {accrete-0.0.142.dist-info → accrete-0.0.144.dist-info}/RECORD +36 -34
  35. accrete/contrib/ui/context.py +0 -123
  36. accrete/contrib/ui/static/css/.sass-cache/15adf1eed05371361b08787c918a7f18fc15be79/accrete.scssc +0 -0
  37. accrete/contrib/ui/utils.py +0 -77
  38. accrete/contrib/user/templates/user/user_form.html +0 -58
  39. {accrete-0.0.142.dist-info → accrete-0.0.144.dist-info}/WHEEL +0 -0
  40. {accrete-0.0.142.dist-info → accrete-0.0.144.dist-info}/licenses/LICENSE +0 -0
@@ -1,77 +0,0 @@
1
- import ast
2
- import json
3
-
4
- from django.http import HttpRequest, HttpResponse
5
- from django.shortcuts import render
6
-
7
- from . import OobContext
8
- from .context import BaseContext, ModalContext
9
- from accrete.utils import render_templates
10
-
11
-
12
- def modal_response(
13
- request: HttpRequest,
14
- template: str,
15
- context: ModalContext | dict,
16
- update: bool = False
17
- ) -> HttpResponse:
18
-
19
- if isinstance(context, ModalContext):
20
- context = context.dict()
21
- res = render(request, template, context)
22
- if update:
23
- res.headers['HX-Retarget'] = f'#{context["modal_id"]}'
24
- res.headers['HX-Reswap'] = 'outerHTML'
25
- return res
26
- res.headers['HX-Retarget'] = 'body'
27
- res.headers['HX-Reswap'] = 'beforeend'
28
- return res
29
-
30
-
31
- def detail_response(
32
- request: HttpRequest,
33
- header_template: str,
34
- content_template: str,
35
- context: BaseContext | dict,
36
- extra_content: str | None = None
37
- ) -> HttpResponse:
38
- if isinstance(context, BaseContext):
39
- context = context.dict()
40
- content = render_templates([
41
- ('ui/message.html', context),
42
- ('ui/oob.html', OobContext(
43
- template=header_template,
44
- swap='innerHTML:#content-right-header',
45
- extra=context
46
- ).dict()),
47
- ('ui/oob.html', OobContext(
48
- template=content_template,
49
- swap='innerHTML:#content-right',
50
- extra=context
51
- ).dict())
52
- ], request=request)
53
- if extra_content:
54
- content += extra_content
55
- res = HttpResponse(content=content)
56
- add_trigger(res, 'activate-content-right')
57
- return res
58
-
59
-
60
- def add_trigger(
61
- response: [HttpResponse],
62
- trigger: dict | str,
63
- header: str = 'HX-Trigger'
64
- ) -> HttpResponse:
65
- if isinstance(trigger, str):
66
- trigger = {trigger: ''}
67
- res_trigger = response.headers.get(header)
68
- if not res_trigger:
69
- response.headers[header] = json.dumps(trigger)
70
- return response
71
- try:
72
- res_trigger = ast.literal_eval(response.headers.get(header, '{}'))
73
- except SyntaxError:
74
- res_trigger = {response.headers[header]: ''}
75
- res_trigger.update(trigger)
76
- response.headers[header] = json.dumps(res_trigger)
77
- return response
@@ -1,58 +0,0 @@
1
- {% extends 'ui/layout.html' %}
2
- {% load i18n %}
3
-
4
- {% block header_left_buttons %}
5
- <button class="button is-light" hx-get="{% url 'user:change_password' %}" hx-target="body" hx-swap="beforeend">
6
- <span>{% translate 'Change Password' %}</span>
7
- </button>
8
- <button class="button is-light" hx-get="{% url 'user:change_email' %}" hx-target="body" hx-swap="beforeend">
9
- <span>{% translate 'Change E-Mail' %}</span>
10
- </button>
11
- {% endblock %}
12
-
13
- {% block content_left %}
14
- <form id="user-form" hx-post="{% url 'user:detail' %}" hx-trigger="change changed" hx-select="#user-form" hx-swap="outerHTML" hx-select-oob="#navbar-user-name">
15
- {% csrf_token %}
16
- <div class="columns m-0">
17
- <div class="column is-6">
18
- {% if form.save_error or form.non_field_errors %}
19
- <div class="notification is-danger is-light">
20
- {{ form.save_error|default_if_none:'' }}
21
- {{ form.non_field_errors|default_if_none:'' }}
22
- </div>
23
- {% endif %}
24
- <label class="label">
25
- {{ form.username.label }}
26
- {{ form.username }}
27
- <span class="has-text-danger is-size-7">{{ form.username.errors }}</span>
28
- </label>
29
- <label class="label">
30
- {{ form.first_name.label }}
31
- {{ form.first_name }}
32
- <span class="has-text-danger is-size-7">{{ form.first_name.errors }}</span>
33
- </label>
34
- <label class="label">
35
- {{ form.last_name.label }}
36
- {{ form.last_name }}
37
- <span class="has-text-danger is-size-7">{{ form.last_name.errors }}</span>
38
- </label>
39
- <label class="label">
40
- {% translate 'E-Mail' %}
41
- <div class="field has-addons">
42
- <p class="control input has-text-weight-normal">{{ user.email }}</p>
43
- </div>
44
- </label>
45
- <label class="label">
46
- {{ form.language_code.label }}
47
- {{ form.language_code }}
48
- <span class="has-text-danger is-size-7">{{ form.language_code.errors }}</span>
49
- </label>
50
- <label class="label">
51
- {{ form.theme.label }}
52
- {{ form.theme }}
53
- <span class="has-text-danger is-size-7">{{ form.theme.errors }}</span>
54
- </label>
55
- </div>
56
- </div>
57
- </form>
58
- {% endblock %}