accrete 0.0.128__py3-none-any.whl → 0.0.130__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.
accrete/admin.py CHANGED
@@ -10,11 +10,13 @@ class MemberInLine(admin.TabularInline):
10
10
  class TenantAccessGroupInLine(admin.TabularInline):
11
11
 
12
12
  model = models.TenantAccessGroupRel
13
+ extra = 0
13
14
 
14
15
 
15
16
  class AccessGroupMemberInLine(admin.TabularInline):
16
17
 
17
18
  model = models.MemberAccessGroupRel
19
+ extra = 0
18
20
 
19
21
 
20
22
  class TenantAdmin(admin.ModelAdmin):
@@ -23,7 +25,7 @@ class TenantAdmin(admin.ModelAdmin):
23
25
  list_display = ('name', 'is_active', 'pk')
24
26
  search_fields = ('pk', 'name')
25
27
  list_filter = ['is_active']
26
- inlines = [MemberInLine, TenantAccessGroupInLine]
28
+ inlines = [TenantAccessGroupInLine, MemberInLine]
27
29
 
28
30
 
29
31
  class MemberAdmin(admin.ModelAdmin):
@@ -32,15 +34,16 @@ class MemberAdmin(admin.ModelAdmin):
32
34
  list_display = ('user', 'tenant', 'is_active')
33
35
  search_fields = ('user__email', 'tenant__name')
34
36
  list_filter = ['is_active']
37
+ fields = ['user', 'tenant', 'is_active']
35
38
  inlines = [AccessGroupMemberInLine]
36
39
 
37
40
 
38
41
  class AccessGroupAdmin(admin.ModelAdmin):
39
42
 
40
43
  model = models.AccessGroup
41
- list_display = ('name', 'code')
44
+ list_display = ('name', 'code', 'apply_on')
42
45
  search_fields = ('name', 'code')
43
- inlines = [AccessGroupMemberInLine]
46
+ list_filter = ['apply_on']
44
47
 
45
48
 
46
49
  admin.site.register(models.Tenant, TenantAdmin)
@@ -144,8 +144,11 @@
144
144
  <div class="is-flex is-justify-content-space-between is-flex-wrap-wrap">
145
145
  <div class="is-flex is-flex-wrap-wrap is-flex-grow-5 is-align-self-center py-2">
146
146
  {% block header_left %}
147
- <div>
148
- <p class="subtitle is-5 px-2 py-1 my-1">{{ title }}</p>
147
+ <div class="mr-2">
148
+ <p class="title is-5 px-2 py-1 my-1">{{ title }}</p>
149
+ </div>
150
+ <div class="buttons">
151
+ {% block header_left_buttons %}{% endblock %}
149
152
  </div>
150
153
  {% endblock %}
151
154
  </div>
@@ -3,10 +3,6 @@
3
3
  {% load ui %}
4
4
  {% load partials %}
5
5
 
6
- {% block header_left %}
7
- {{ block.super }}
8
- {% endblock %}
9
-
10
6
  {% block content_left %}
11
7
  <div class="fixed-grid has-{{ column_count }}-cols has-1-cols-mobile m-2">
12
8
  <div id="list-grid" class="grid m-0">
@@ -1,12 +1,11 @@
1
1
  {% extends 'ui/layout.html' %}
2
2
  {% load i18n %}
3
3
 
4
- {% block header_left %}
5
- {{ block.super }}
6
- <button class="button p-2 my-1 mr-1 is-light" hx-get="{% url 'user:change_password' %}" hx-target="body" hx-swap="beforeend">
4
+ {% block header_left_buttons %}
5
+ <button class="button is-light" hx-get="{% url 'user:change_password' %}" hx-target="body" hx-swap="beforeend">
7
6
  <span>{% translate 'Change Password' %}</span>
8
7
  </button>
9
- <button class="button p-2 my-1 mr-1 is-light" hx-get="{% url 'user:change_email' %}" hx-target="body" hx-swap="beforeend">
8
+ <button class="button is-light" hx-get="{% url 'user:change_email' %}" hx-target="body" hx-swap="beforeend">
10
9
  <span>{% translate 'Change E-Mail' %}</span>
11
10
  </button>
12
11
  {% endblock %}
@@ -0,0 +1,28 @@
1
+ # Generated by Django 5.1.4 on 2025-03-06 09:53
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('accrete', '0004_rename_accessgroupmember_memberaccessgrouprel_and_more'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddField(
14
+ model_name='accessgroup',
15
+ name='apply_on',
16
+ field=models.CharField(choices=[('tenant', 'Tenant'), ('member', 'Member')], default='tenant', help_text='', max_length=10, verbose_name='Apply On'),
17
+ ),
18
+ migrations.AlterField(
19
+ model_name='member',
20
+ name='access_groups',
21
+ field=models.ManyToManyField(blank=True, through='accrete.MemberAccessGroupRel', to='accrete.accessgroup'),
22
+ ),
23
+ migrations.AlterField(
24
+ model_name='tenant',
25
+ name='access_groups',
26
+ field=models.ManyToManyField(blank=True, through='accrete.TenantAccessGroupRel', to='accrete.accessgroup'),
27
+ ),
28
+ ]
accrete/models.py CHANGED
@@ -1,3 +1,4 @@
1
+ from django.core.exceptions import ValidationError
1
2
  from django.db import models
2
3
  from django.conf import settings
3
4
  from django.utils.translation import gettext_lazy as _
@@ -70,7 +71,8 @@ class Tenant(models.Model):
70
71
  access_groups = models.ManyToManyField(
71
72
  to='accrete.AccessGroup',
72
73
  through='accrete.TenantAccessGroupRel',
73
- through_fields=('tenant', 'access_group')
74
+ through_fields=('tenant', 'access_group'),
75
+ blank=True
74
76
  )
75
77
 
76
78
  def __str__(self):
@@ -105,7 +107,8 @@ class Member(models.Model):
105
107
  access_groups = models.ManyToManyField(
106
108
  to='accrete.AccessGroup',
107
109
  through='accrete.MemberAccessGroupRel',
108
- through_fields=('member', 'access_group')
110
+ through_fields=('member', 'access_group'),
111
+ blank=True
109
112
  )
110
113
 
111
114
  objects = MemberManager()
@@ -138,6 +141,17 @@ class AccessGroup(models.Model):
138
141
  max_length=100
139
142
  )
140
143
 
144
+ apply_on = models.CharField(
145
+ verbose_name=_('Apply On'),
146
+ max_length=10,
147
+ choices=[
148
+ ('tenant', _('Tenant')),
149
+ ('member', _('Member'))
150
+ ],
151
+ default='tenant',
152
+ help_text=_('')
153
+ )
154
+
141
155
  def __str__(self):
142
156
  return self.name
143
157
 
@@ -169,6 +183,10 @@ class MemberAccessGroupRel(models.Model):
169
183
  def __str__(self):
170
184
  return f'{self.member} - {self.access_group}'
171
185
 
186
+ def clean(self):
187
+ if self.access_group.apply_on != 'member':
188
+ raise ValidationError(_('Access Group must apply on members'))
189
+
172
190
 
173
191
  class TenantAccessGroupRel(models.Model):
174
192
 
@@ -196,3 +214,7 @@ class TenantAccessGroupRel(models.Model):
196
214
 
197
215
  def __str__(self):
198
216
  return f'{self.tenant} - {self.access_group}'
217
+
218
+ def clean(self):
219
+ if self.access_group.apply_on != 'tenant':
220
+ raise ValidationError(_('Access Group must apply on tenants'))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: accrete
3
- Version: 0.0.128
3
+ Version: 0.0.130
4
4
  Summary: Django Shared Schema Multi Tenant
5
5
  Author-email: Benedikt Jilek <benedikt.jilek@pm.me>
6
6
  License: Copyright (c) 2023 Benedikt Jilek
@@ -1,5 +1,5 @@
1
1
  accrete/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- accrete/admin.py,sha256=6NiX8_3pYIhnru5hNzvnW4xfzWsbf7gZj8Z2p38xIOk,1232
2
+ accrete/admin.py,sha256=sK7jzjVTdAPim3TnOluRdorRZYVt2Rv8vx7Bw7dix-I,1308
3
3
  accrete/apps.py,sha256=F7ynMLHJr_6bRujWtZVUzCliY2CGKiDvyUmL4F68L2E,146
4
4
  accrete/config.py,sha256=1Yubvz5PVdCsX0tA7HvazhtnvCvgCoEl33_dR8SHpb8,392
5
5
  accrete/context_processors.py,sha256=DySglwyD2TwPsxhElVkYDvyBBUJabEKGMiKCLe0KN4Q,148
@@ -7,7 +7,7 @@ accrete/fields.py,sha256=9SlltB5AJvDfiAbYGWZemrqpjqDl1XNgNrhyTGoBJ2A,4693
7
7
  accrete/forms.py,sha256=H2hPQemslRLvTVV0Wl1TfUmTc5wU3Z98nQTMiLMliqo,1288
8
8
  accrete/managers.py,sha256=DevRVm7cStvlfz6TriitSINr40POCi4HNaHX48VkrMA,1620
9
9
  accrete/middleware.py,sha256=YN73WloNkN01oel9Dcj3xyhurcWoB6zMV0NT3hY8DGw,2264
10
- accrete/models.py,sha256=01UPWHmkWg3CcgPjImaSvS7OPh1Xx7lQ1nsJxZNN53k,4879
10
+ accrete/models.py,sha256=vGVDso638MGL70VYwhLpNHesTVggbNNkMW0Z0siX_ys,5517
11
11
  accrete/storage.py,sha256=Jp3oE_uPMqgarjS_G49KDFrR2eSe4XuIJK9oAF_QBxk,1288
12
12
  accrete/tenant.py,sha256=GGKEhKLsC6JAkNGrMvp4l8ScsyfrDMocwJL5LBPe2Go,2307
13
13
  accrete/tests.py,sha256=Agltbzwwh5htvq_Qi9vqvxutzmg_GwgPS_N19xJZRlw,7197
@@ -197,8 +197,8 @@ accrete/contrib/ui/templates/django/forms/widgets/text.html,sha256=MSmLlQc7PsPoD
197
197
  accrete/contrib/ui/templates/django/forms/widgets/textarea.html,sha256=c9BTedqb3IkXLyVYd0p9pR8DFnsXCNGoxVBWZTk_Fic,278
198
198
  accrete/contrib/ui/templates/ui/content_right.html,sha256=XUF1tYpSKfO9FleYtJ2QmWPmwdLYxLHXdBLRa-BrFUs,221
199
199
  accrete/contrib/ui/templates/ui/form_error.html,sha256=uA8FLdZyeU0vXJHlGK3rcBqcmXb63MLPV32uQyUTak4,348
200
- accrete/contrib/ui/templates/ui/layout.html,sha256=l94vfodM5lGbtF3ZOBeSbesZki9LsEpfitH9bC1GEYk,12668
201
- accrete/contrib/ui/templates/ui/list.html,sha256=NY8DmHGl3n5O1u-_B9a_mlAck19ZmpYthzecADuc3BM,2250
200
+ accrete/contrib/ui/templates/ui/layout.html,sha256=QTkcHPwOLdNq_HpT3AYUUCsH9yjINeN0QNbIkjFwQ8Y,12889
201
+ accrete/contrib/ui/templates/ui/list.html,sha256=XLcZn7H3DAwCzwd5ejd5IWLFhWhXUtIhj2OvLq2cjtE,2188
202
202
  accrete/contrib/ui/templates/ui/list_update.html,sha256=mLQTCgkKfVI5jrgei-Upc1u87iXL0Q63uLzXHPwMyeo,110
203
203
  accrete/contrib/ui/templates/ui/message.html,sha256=t3bZ5EE7IgQYJroCdLKFeUkZiNbgKkErVYQm6Y3IKpg,532
204
204
  accrete/contrib/ui/templates/ui/modal.html,sha256=9Gnj5qhIJrnAPgAuIUkrSWeuYyKppywvmK1483AMhxY,1870
@@ -235,7 +235,7 @@ accrete/contrib/user/templates/user/accrete_navbar_end_dropdown.html,sha256=suPo
235
235
  accrete/contrib/user/templates/user/change_email.html,sha256=w9gBnU_O45YchY0EqD9mUK5oeDaD4cN92tHN80QjReA,815
236
236
  accrete/contrib/user/templates/user/change_password.html,sha256=1U7cI-xshsy_nhSj3TUqL3tPtYaBF17XFDgJHXXDzIw,1021
237
237
  accrete/contrib/user/templates/user/login.html,sha256=SXbxgq3baEch3ksGMsZqIws5heqAtpkdCLAFX3SLhtQ,2669
238
- accrete/contrib/user/templates/user/user_form.html,sha256=KVHqtoss9ttft0K4yukSr4lB4ob8Ayj-eTokh60Efn8,2683
238
+ accrete/contrib/user/templates/user/user_form.html,sha256=fPbbUnx2URhdW9-by26q3xe3_w23de42Nj25BOC3qrs,2641
239
239
  accrete/contrib/user_registration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
240
240
  accrete/contrib/user_registration/admin.py,sha256=kwmGTsg4Hii-lsw9-UaJG7AhQ4k4SPi48GSrtpZ4YR4,119
241
241
  accrete/contrib/user_registration/apps.py,sha256=mYu3fuuubfjImeJHk4D_Wd6Edw2r3oUNXGcFbAkhir4,181
@@ -253,6 +253,7 @@ accrete/migrations/0001_initial.py,sha256=azThbc8otEhxJwo8BIgOt5eC30mxXhKJLBAazZ
253
253
  accrete/migrations/0002_initial.py,sha256=dFOM7kdHlx7pVAh8cTDlZMtciN4O9Z547HAzEKnygZE,1628
254
254
  accrete/migrations/0003_remove_member_name.py,sha256=bnZrzOIXcqsoGfbqgohTN5OHm2IldnLlBz1HNJDeqKc,315
255
255
  accrete/migrations/0004_rename_accessgroupmember_memberaccessgrouprel_and_more.py,sha256=NXEKuRyIjLFXqycWB1jIZFQ0ppevMwz1I6rAr9qKrk4,1404
256
+ accrete/migrations/0005_accessgroup_apply_on_alter_member_access_groups_and_more.py,sha256=1ZL_PG2W_5h1x1oGAUALn2Ks0kzbFusHF7XEXE1J9Pg,996
256
257
  accrete/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
257
258
  accrete/utils/__init__.py,sha256=saw9zi2XItJOPbv4fjTXOpl7StNtC803jHhapFcGx08,312
258
259
  accrete/utils/dates.py,sha256=apM6kt6JhGrKgoT0jfav1W-8AUVTxNc9xt3fJQ2n0JI,1492
@@ -260,7 +261,7 @@ accrete/utils/forms.py,sha256=1UQoG0cXel4Tg-a_cG9doJNrl62a0JMDVEYrT5TSX1s,3383
260
261
  accrete/utils/log.py,sha256=BH0MBDweAjx30wGBO4F3sFhbgkSoEs7T1lLLjlYZNnA,407
261
262
  accrete/utils/models.py,sha256=2xTacvcpmDK_Bp4rAK7JdVLf8HU009LYNJ6eSpMgYZI,1014
262
263
  accrete/utils/views.py,sha256=AutijWetWGgjdO1PNc4gxCblT-i1fAfldNDFRbO9Sac,5012
263
- accrete-0.0.128.dist-info/METADATA,sha256=3HnKri4Msg5AjnVNVEP5NRET1BmJb-geQnwOmWStajk,4953
264
- accrete-0.0.128.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
265
- accrete-0.0.128.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
266
- accrete-0.0.128.dist-info/RECORD,,
264
+ accrete-0.0.130.dist-info/METADATA,sha256=HFmr4d3mkfMC7k78non4bjbwVwS1W00cAaDawMDELCc,4953
265
+ accrete-0.0.130.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
266
+ accrete-0.0.130.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
267
+ accrete-0.0.130.dist-info/RECORD,,