accrete 0.0.139__py3-none-any.whl → 0.0.141__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.
@@ -33,8 +33,6 @@ class Filter:
33
33
  LABEL_OR = _('Or')
34
34
  LABEL_XOR = _('Not Or')
35
35
 
36
- # EXCLUDE = ['tenant']
37
-
38
36
  DATE_FORMAT = '%Y-%m-%d'
39
37
 
40
38
  TYPES_INTEGER = [
@@ -66,7 +66,7 @@ class UserManager(BaseUserManager):
66
66
  extra_fields.setdefault('is_active', False)
67
67
  return self._create_user(password, email, login, username, **extra_fields)
68
68
 
69
- def create_superuser(self, email, password, username=None, **extra_fields):
69
+ def create_superuser(self, password, email, username=None, **extra_fields):
70
70
  extra_fields.setdefault('is_staff', True)
71
71
  extra_fields.setdefault('is_superuser', True)
72
72
  extra_fields.setdefault('is_active', True)
@@ -76,7 +76,7 @@ class UserManager(BaseUserManager):
76
76
  if extra_fields.get('is_superuser') is not True:
77
77
  raise ValueError('Superuser must have is_superuser=True.')
78
78
 
79
- return self._create_user(email, password, username, **extra_fields)
79
+ return self._create_user(password, email, username, **extra_fields)
80
80
 
81
81
 
82
82
  class User(AbstractBaseUser, PermissionsMixin):
@@ -98,10 +98,6 @@ class User(AbstractBaseUser, PermissionsMixin):
98
98
  )
99
99
  ]
100
100
 
101
- filter_exclude = [
102
- 'password'
103
- ]
104
-
105
101
  username_validator = UnicodeUsernameValidator()
106
102
  login_validator = validate_member_login
107
103
 
@@ -211,3 +207,7 @@ class User(AbstractBaseUser, PermissionsMixin):
211
207
  def all_tenants(self):
212
208
  tenants = Tenant.objects.filter(members__user=self)
213
209
  return tenants
210
+
211
+ @staticmethod
212
+ def exclude_from_filter():
213
+ return ['password']
@@ -80,7 +80,7 @@ def user_change_password(request):
80
80
  + f'?{request.GET.urlencode()}'
81
81
  )
82
82
  ctx.update(form=form)
83
- return ui.modal_response(request, 'user/change_password.html', ctx)
83
+ return ui.modal_response(request, 'user/change_password.html', ctx, update=True)
84
84
  return render(request, 'user/change_password.html', ctx)
85
85
 
86
86
 
@@ -103,5 +103,5 @@ def user_change_email(request):
103
103
  if form.is_saved:
104
104
  return redirect('user:detail')
105
105
  ctx.update(form=form)
106
- return ui.modal_response(request, 'user/change_email.html', ctx)
106
+ return ui.modal_response(request, 'user/change_email.html', ctx, update=True)
107
107
  return render(request, 'user/change_email.html', ctx)
accrete/views.py CHANGED
@@ -1,11 +1,10 @@
1
1
  import os
2
- from enum import Enum
3
2
  from functools import wraps
4
3
  from django.http import HttpResponse, HttpResponseNotFound
5
4
  from django.contrib.auth.mixins import LoginRequiredMixin
6
5
  from django.contrib.auth.views import login_required
7
6
  from django.core.exceptions import ImproperlyConfigured
8
- from django.shortcuts import redirect, get_object_or_404
7
+ from django.shortcuts import redirect, get_object_or_404, resolve_url
9
8
  from django.conf import settings
10
9
  from accrete.models import Tenant, Member
11
10
  from accrete.tenant import get_tenant, tenant_has_group, member_has_group
@@ -26,9 +25,10 @@ class TenantRequiredMixin(LoginRequiredMixin):
26
25
 
27
26
  def dispatch(self, request, *args, **kwargs):
28
27
  res = super().dispatch(request, *args, **kwargs)
29
- tenant = self.get_tenant()
30
- if not tenant:
28
+ if not self.get_tenant():
31
29
  return self.handle_tenant_not_set()
30
+ if self.request.user.is_superuser:
31
+ return res
32
32
  if not self.check_tenant_group():
33
33
  return self.handle_tenant_group_not_set()
34
34
  if not self.check_member_group():
@@ -36,7 +36,10 @@ class TenantRequiredMixin(LoginRequiredMixin):
36
36
  return res
37
37
 
38
38
  def handle_tenant_not_set(self):
39
- return redirect(self.get_tenant_not_set_url())
39
+ return redirect(
40
+ resolve_url(self.get_tenant_not_set_url())
41
+ + f'?next={self.request.get_full_path_info()}'
42
+ )
40
43
 
41
44
  def handle_tenant_group_not_set(self):
42
45
  return redirect(self.get_group_not_set_url())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: accrete
3
- Version: 0.0.139
3
+ Version: 0.0.141
4
4
  Summary: Django Shared Schema Multi Tenant
5
5
  Author-email: Benedikt Jilek <benedikt.jilek@pm.me>
6
6
  License: Copyright (c) 2025 Benedikt Jilek
@@ -12,7 +12,7 @@ accrete/storage.py,sha256=Jp3oE_uPMqgarjS_G49KDFrR2eSe4XuIJK9oAF_QBxk,1288
12
12
  accrete/tenant.py,sha256=vfalmdfDsjYbl-ol3RqvsTC-YnuQs0JuSC7o85UInG0,2289
13
13
  accrete/tests.py,sha256=Agltbzwwh5htvq_Qi9vqvxutzmg_GwgPS_N19xJZRlw,7197
14
14
  accrete/urls.py,sha256=goDFR-yhOlLLy7AMi9pmh2aBkxdtZtwXNg6mwI2zPhU,227
15
- accrete/views.py,sha256=vYAWT5ZKeKYWBlrfImqhoUV6MqU2Kntcor0hCvxGm-s,5735
15
+ accrete/views.py,sha256=JNv1T9Bv_eay5LcPauoSSeyga7ftNIZg9xdPSOQPUnI,5862
16
16
  accrete/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  accrete/contrib/country/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  accrete/contrib/country/admin.py,sha256=0dAcFPfC8c80fhKKOL26-5Wl1uWXBYrkUJEjo2sEkk4,329
@@ -64,7 +64,7 @@ accrete/contrib/ui/__init__.py,sha256=3kcANg-pw-KR_JdAV1C-EtgPceAQmYbNq5tUJ7e5X0
64
64
  accrete/contrib/ui/admin.py,sha256=suMo4x8I3JBxAFBVIdE-5qnqZ6JAZV0FESABHOSc-vg,63
65
65
  accrete/contrib/ui/apps.py,sha256=E0ao2ox6PQ3ldfeR17FXJUUJuGiWjm2DPCxHbPXGzls,152
66
66
  accrete/contrib/ui/context.py,sha256=689qnX9u3Nqrw8t08td38X2PoSSH935qm6sQj5MPznE,2680
67
- accrete/contrib/ui/filter.py,sha256=9JO5-9CfnVA2jQz3SaQ1BlrV85c6O8KlCZEiGJIO1PY,13351
67
+ accrete/contrib/ui/filter.py,sha256=zLTWWSvsfvwBMNWgpZqP2kRKXCVW_50mhTQyJA36ywo,13323
68
68
  accrete/contrib/ui/middleware.py,sha256=QprWR8FXK9iMPIvLQAeYASaUJSW0uD9BHoYroMKrph0,1560
69
69
  accrete/contrib/ui/models.py,sha256=Vjc0p2XbAPgE6HyTF6vll98A4eDhA5AvaQqsc4kQ9AQ,57
70
70
  accrete/contrib/ui/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
@@ -226,10 +226,10 @@ accrete/contrib/user/apps.py,sha256=oHDrAiHf-G57mZLyxqGJzRY2DbPprGFD-QgyVJG_ruI,
226
226
  accrete/contrib/user/auth_backends.py,sha256=doGdxil4fjhgY5oC2s8zueQq-bQsZ1fyiAo46HyBHLk,598
227
227
  accrete/contrib/user/forms.py,sha256=BpwF_t1-7BpBVmwLpIm6hdqUpPqajoR0ZGOJ8cmaO6M,3290
228
228
  accrete/contrib/user/middleware.py,sha256=qblcujwJsthopagyT-hPFq4HsMyGt-VvqZw5TQopBjk,403
229
- accrete/contrib/user/models.py,sha256=X8rr81gVgK2lf58yozGFGrEm7jDtBFCIIGnR_10fr3g,6228
229
+ accrete/contrib/user/models.py,sha256=8vgDZ2Jf-aFOC12W1vKObaK9FJUwcuWwQWqAi2hXQZg,6257
230
230
  accrete/contrib/user/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
231
231
  accrete/contrib/user/urls.py,sha256=_fBa--3NfyYN10Td7PGHpetJYy42SMqTyCCXhgynkEQ,407
232
- accrete/contrib/user/views.py,sha256=df6Ns5XO__BuTgkj1DoeNitT7cdeToh7u7gjycYwngY,3409
232
+ accrete/contrib/user/views.py,sha256=oPiyyO7RnfI48iKCO7O5_HMk2vioNEUDowKRe-Xwzm0,3435
233
233
  accrete/contrib/user/locale/de/LC_MESSAGES/django.mo,sha256=p3rgUg6WltAVIMkQsjvjBqTsd_usLhSr1GH4Cyltc2c,433
234
234
  accrete/contrib/user/locale/de/LC_MESSAGES/django.po,sha256=f_Nxpo3HTm2L3f3zoHLfeWsZ-4IQp_EEVSku6TCZSvw,1870
235
235
  accrete/contrib/user/migrations/0001_initial.py,sha256=JWfM9PcMDfkJUdCjLWuWieGs6643qP0KdbCyr5uAZoY,2950
@@ -273,7 +273,7 @@ accrete/utils/forms.py,sha256=JJ3EY1xcVP6L10i5cSVgh57G0uvFUjiVwUCpEqmBCos,3407
273
273
  accrete/utils/log.py,sha256=BH0MBDweAjx30wGBO4F3sFhbgkSoEs7T1lLLjlYZNnA,407
274
274
  accrete/utils/models.py,sha256=2xTacvcpmDK_Bp4rAK7JdVLf8HU009LYNJ6eSpMgYZI,1014
275
275
  accrete/utils/views.py,sha256=PsKpUFjxCm6_l_nfVs-cNIY0lNTdkocm2uohR3o9eEo,5025
276
- accrete-0.0.139.dist-info/METADATA,sha256=V2BAlAqd5s7JUcN3dnmCjD39ecIhUfpGu_g9nmwFR2g,4953
277
- accrete-0.0.139.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
278
- accrete-0.0.139.dist-info/licenses/LICENSE,sha256=vHwb4Qnv8UfYKFiCWyTuRGsi49x19UQwHRCky3b2_NE,1057
279
- accrete-0.0.139.dist-info/RECORD,,
276
+ accrete-0.0.141.dist-info/METADATA,sha256=QLIHDvSd9FfMNLcAjZXpdmt8V50SY3laTZlfQhed0c0,4953
277
+ accrete-0.0.141.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
278
+ accrete-0.0.141.dist-info/licenses/LICENSE,sha256=vHwb4Qnv8UfYKFiCWyTuRGsi49x19UQwHRCky3b2_NE,1057
279
+ accrete-0.0.141.dist-info/RECORD,,