accrete 0.0.125__py3-none-any.whl → 0.0.126__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/contrib/log/helper.py +1 -1
- accrete/contrib/system_mail/forms.py +2 -1
- accrete/contrib/user/models.py +1 -0
- accrete/utils/forms.py +9 -2
- {accrete-0.0.125.dist-info → accrete-0.0.126.dist-info}/METADATA +1 -1
- {accrete-0.0.125.dist-info → accrete-0.0.126.dist-info}/RECORD +8 -8
- {accrete-0.0.125.dist-info → accrete-0.0.126.dist-info}/WHEEL +0 -0
- {accrete-0.0.125.dist-info → accrete-0.0.126.dist-info}/licenses/LICENSE +0 -0
accrete/contrib/log/helper.py
CHANGED
@@ -46,7 +46,7 @@ def log_state_to_dict(logs: RawQuerySet) -> tuple[dict, dict]:
|
|
46
46
|
return state, info
|
47
47
|
|
48
48
|
|
49
|
-
def log_value_to_instance_value(log: Log):
|
49
|
+
def log_value_to_instance_value(log: Log) -> bool | int | None:
|
50
50
|
if log.new_value_type == 'bool':
|
51
51
|
return bool(log.new_value == 'True')
|
52
52
|
|
@@ -23,7 +23,8 @@ class SystemMailCreateForm(forms.ModelForm):
|
|
23
23
|
def clean_to_addr(self):
|
24
24
|
emails = self.cleaned_data['to_addr']
|
25
25
|
for email in emails.split(','):
|
26
|
-
|
26
|
+
if email:
|
27
|
+
validate_email(email)
|
27
28
|
return emails
|
28
29
|
|
29
30
|
def save(self, commit=True):
|
accrete/contrib/user/models.py
CHANGED
@@ -35,6 +35,7 @@ class UserManager(BaseUserManager):
|
|
35
35
|
def create_user(self, email, password=None, username=None, **extra_fields):
|
36
36
|
extra_fields.setdefault('is_staff', False)
|
37
37
|
extra_fields.setdefault('is_superuser', False)
|
38
|
+
extra_fields.setdefault('is_active', False)
|
38
39
|
return self._create_user(email, password, username, **extra_fields)
|
39
40
|
|
40
41
|
def create_superuser(self, email, password, username=None, **extra_fields):
|
accrete/utils/forms.py
CHANGED
@@ -9,13 +9,16 @@ _logger = logging.getLogger(__name__)
|
|
9
9
|
|
10
10
|
|
11
11
|
def save_form(form: [Form|ModelForm], commit=True, reraise=False) -> [Form|ModelForm]:
|
12
|
+
if not hasattr(form, 'save'):
|
13
|
+
raise AttributeError('Form must have method "save" implemented.')
|
12
14
|
form.is_saved = False
|
13
15
|
form.save_error = None
|
14
16
|
form.save_error_id = None
|
17
|
+
form.res = None
|
15
18
|
try:
|
16
19
|
if form.is_valid():
|
17
20
|
with transaction.atomic():
|
18
|
-
form.save(commit=commit)
|
21
|
+
form.res = form.save(commit=commit)
|
19
22
|
form.is_saved = True
|
20
23
|
except Exception as e:
|
21
24
|
form.save_error = repr(e)
|
@@ -35,9 +38,13 @@ def save_forms(form, inline_formsets: list = None, commit=True, reraise: bool =
|
|
35
38
|
_logger.exception(f'{error_id}: {error}')
|
36
39
|
form.save_error_id = error_id
|
37
40
|
|
41
|
+
if not hasattr(form, 'save'):
|
42
|
+
raise AttributeError('Form must have method "save" implemented.')
|
43
|
+
|
38
44
|
form.is_saved = False
|
39
45
|
form.save_error = None
|
40
46
|
form.save_error_id = None
|
47
|
+
form.res = None
|
41
48
|
form.inline_forms = inline_formsets
|
42
49
|
|
43
50
|
try:
|
@@ -56,7 +63,7 @@ def save_forms(form, inline_formsets: list = None, commit=True, reraise: bool =
|
|
56
63
|
|
57
64
|
try:
|
58
65
|
with transaction.atomic():
|
59
|
-
form.save(commit=commit)
|
66
|
+
form.res = form.save(commit=commit)
|
60
67
|
for inline_formset in inline_formsets:
|
61
68
|
inline_formset.save(commit=commit)
|
62
69
|
except Exception as e:
|
@@ -25,7 +25,7 @@ accrete/contrib/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
25
25
|
accrete/contrib/log/admin.py,sha256=xeuLk1GdU_M0rZR8SQUzcMeWvV9ud0hz_LJmaut5eJE,1211
|
26
26
|
accrete/contrib/log/apps.py,sha256=O0Cje3MmpxPToJVgO195lBg0tRCy9Ou87-ntcdGBKM0,369
|
27
27
|
accrete/contrib/log/config.py,sha256=vRzPVbiUfpo5NGtgiJv5mEKR_h3qsYI_brxjni6-Z-Y,132
|
28
|
-
accrete/contrib/log/helper.py,sha256=
|
28
|
+
accrete/contrib/log/helper.py,sha256=n5QXPf4Lo8NvxDaJifZs4QVNJdiNyr17e_z26QT9V-U,2514
|
29
29
|
accrete/contrib/log/models.py,sha256=XRElQUV6Obj4BCMTXE85jcpEup7m-MCRVfquxmt9_Xc,6210
|
30
30
|
accrete/contrib/log/queries.py,sha256=JMI_q6dQ0JjyORtfRPOW92of45TFxqPiwIhHEEar34o,1126
|
31
31
|
accrete/contrib/log/signals.py,sha256=OTV4Ajd3oiICLPkLBjfGmeE_FNDsUmThbwQ-K6BH6_k,2174
|
@@ -52,7 +52,7 @@ accrete/contrib/sequence/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQ
|
|
52
52
|
accrete/contrib/system_mail/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
53
|
accrete/contrib/system_mail/admin.py,sha256=9hXwwfZn446juyRoBOygLWm12X6N9waRC-1LHBLrgZk,227
|
54
54
|
accrete/contrib/system_mail/apps.py,sha256=yIWgsa5GV8NPOJBtDZQJljSZ5v_mOP6VJrTfo_HkLF8,169
|
55
|
-
accrete/contrib/system_mail/forms.py,sha256=
|
55
|
+
accrete/contrib/system_mail/forms.py,sha256=AQlQW0hW3KM5cU-y02DWb7HlCD4pcJAD7L5UZmqmnTc,750
|
56
56
|
accrete/contrib/system_mail/models.py,sha256=mTx8YAtyyrUE2B8iKQDyJVsUqN1EGHg8XKgdoWibZ9g,880
|
57
57
|
accrete/contrib/system_mail/tasks.py,sha256=W3q40AxcjGFt7wtuvblQ_WFYIaipYF-WWkDYGvbkYhQ,1326
|
58
58
|
accrete/contrib/system_mail/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
|
@@ -221,7 +221,7 @@ accrete/contrib/user/admin.py,sha256=YS4iApli7XUaIl9GsEJxys2j8sepX0by88omYHjff-E
|
|
221
221
|
accrete/contrib/user/apps.py,sha256=oHDrAiHf-G57mZLyxqGJzRY2DbPprGFD-QgyVJG_ruI,156
|
222
222
|
accrete/contrib/user/forms.py,sha256=BpwF_t1-7BpBVmwLpIm6hdqUpPqajoR0ZGOJ8cmaO6M,3290
|
223
223
|
accrete/contrib/user/middleware.py,sha256=qblcujwJsthopagyT-hPFq4HsMyGt-VvqZw5TQopBjk,403
|
224
|
-
accrete/contrib/user/models.py,sha256=
|
224
|
+
accrete/contrib/user/models.py,sha256=9U7SPbR9IuXhEVdlncsPOZdcbPoWcHRcQi3i25y07Hc,4331
|
225
225
|
accrete/contrib/user/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
|
226
226
|
accrete/contrib/user/urls.py,sha256=_fBa--3NfyYN10Td7PGHpetJYy42SMqTyCCXhgynkEQ,407
|
227
227
|
accrete/contrib/user/views.py,sha256=8_on6l7GRhoRG74j70JQKUcqxx21AZP_5IRWf0I8ZCc,3447
|
@@ -255,11 +255,11 @@ accrete/migrations/0004_rename_accessgroupmember_memberaccessgrouprel_and_more.p
|
|
255
255
|
accrete/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
256
256
|
accrete/utils/__init__.py,sha256=saw9zi2XItJOPbv4fjTXOpl7StNtC803jHhapFcGx08,312
|
257
257
|
accrete/utils/dates.py,sha256=apM6kt6JhGrKgoT0jfav1W-8AUVTxNc9xt3fJQ2n0JI,1492
|
258
|
-
accrete/utils/forms.py,sha256=
|
258
|
+
accrete/utils/forms.py,sha256=1UQoG0cXel4Tg-a_cG9doJNrl62a0JMDVEYrT5TSX1s,3383
|
259
259
|
accrete/utils/log.py,sha256=BH0MBDweAjx30wGBO4F3sFhbgkSoEs7T1lLLjlYZNnA,407
|
260
260
|
accrete/utils/models.py,sha256=2xTacvcpmDK_Bp4rAK7JdVLf8HU009LYNJ6eSpMgYZI,1014
|
261
261
|
accrete/utils/views.py,sha256=AutijWetWGgjdO1PNc4gxCblT-i1fAfldNDFRbO9Sac,5012
|
262
|
-
accrete-0.0.
|
263
|
-
accrete-0.0.
|
264
|
-
accrete-0.0.
|
265
|
-
accrete-0.0.
|
262
|
+
accrete-0.0.126.dist-info/METADATA,sha256=VKDm7rneeTHPMkV34gh-IO7rbliXvptbo21uzt7lpDY,4953
|
263
|
+
accrete-0.0.126.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
264
|
+
accrete-0.0.126.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
|
265
|
+
accrete-0.0.126.dist-info/RECORD,,
|
File without changes
|
File without changes
|