utg-base 1.7.0__py3-none-any.whl → 1.8.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.
utg_base/celery/apps.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from django.apps import AppConfig
2
2
 
3
3
 
4
- class QApiConfig(AppConfig):
4
+ class CeleryApiConfig(AppConfig):
5
5
  default_auto_field = "django.db.models.BigAutoField"
6
6
  name = "utg_base.celery"
File without changes
@@ -0,0 +1,6 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class MigrationApiConfig(AppConfig):
5
+ default_auto_field = "django.db.models.BigAutoField"
6
+ name = "utg_base.migration"
File without changes
File without changes
@@ -0,0 +1,91 @@
1
+ import os
2
+
3
+ from django.core.management.commands.makemigrations import Command as BaseMakeMigrations
4
+ from django.core.management.utils import run_formatters
5
+ from django.db.migrations.writer import MigrationWriter
6
+
7
+
8
+ class Command(BaseMakeMigrations):
9
+
10
+ def write_migration_files(self, changes, update_previous_migration_paths=None):
11
+ """
12
+ Take a changes dict and write them out as migration files.
13
+ """
14
+ directory_created = {}
15
+ for app_label, app_migrations in changes.items():
16
+ if self.verbosity >= 1:
17
+ self.log(self.style.MIGRATE_HEADING("Migrations for '%s':" % app_label))
18
+ for migration in app_migrations:
19
+ # Describe the migration
20
+ writer = MigrationWriter(migration, self.include_header)
21
+
22
+ # BEGIN Customizing
23
+ # fix 'created_at', 'updated_at' fields order
24
+ for operation in migration.operations:
25
+ _fields = []
26
+ _end_fields = []
27
+ for field_name, field in operation.fields:
28
+ if field_name in ['created_at', 'updated_at']:
29
+ _end_fields.append((field_name, field))
30
+ else:
31
+ _fields.append((field_name, field))
32
+
33
+ operation.fields = _fields + _end_fields
34
+
35
+ # END Customizing
36
+
37
+ if self.verbosity >= 1:
38
+ # Display a relative path if it's below the current working
39
+ # directory, or an absolute path otherwise.
40
+ migration_string = self.get_relative_path(writer.path)
41
+ self.log(" %s\n" % self.style.MIGRATE_LABEL(migration_string))
42
+ for operation in migration.operations:
43
+ self.log(" %s" % operation.formatted_description())
44
+ if self.scriptable:
45
+ self.stdout.write(migration_string)
46
+ if not self.dry_run:
47
+ # Write the migrations file to the disk.
48
+ migrations_directory = os.path.dirname(writer.path)
49
+ if not directory_created.get(app_label):
50
+ os.makedirs(migrations_directory, exist_ok=True)
51
+ init_path = os.path.join(migrations_directory, "__init__.py")
52
+ if not os.path.isfile(init_path):
53
+ open(init_path, "w").close()
54
+ # We just do this once per app
55
+ directory_created[app_label] = True
56
+ migration_string = writer.as_string()
57
+ with open(writer.path, "w", encoding="utf-8") as fh:
58
+ fh.write(migration_string)
59
+ self.written_files.append(writer.path)
60
+ if update_previous_migration_paths:
61
+ prev_path = update_previous_migration_paths[app_label]
62
+ rel_prev_path = self.get_relative_path(prev_path)
63
+ if writer.needs_manual_porting:
64
+ migration_path = self.get_relative_path(writer.path)
65
+ self.log(
66
+ self.style.WARNING(
67
+ f"Updated migration {migration_path} requires "
68
+ f"manual porting.\n"
69
+ f"Previous migration {rel_prev_path} was kept and "
70
+ f"must be deleted after porting functions manually."
71
+ )
72
+ )
73
+ else:
74
+ os.remove(prev_path)
75
+ self.log(f"Deleted {rel_prev_path}")
76
+ elif self.verbosity == 3:
77
+ # Alternatively, makemigrations --dry-run --verbosity 3
78
+ # will log the migrations rather than saving the file to
79
+ # the disk.
80
+ self.log(
81
+ self.style.MIGRATE_HEADING(
82
+ "Full migrations file '%s':" % writer.filename
83
+ )
84
+ )
85
+ self.log(writer.as_string())
86
+ run_formatters(self.written_files, stderr=self.stderr)
87
+
88
+ def handle(self, *args, **options):
89
+ self.written_files = []
90
+ result = super().handle(*args, **options)
91
+ return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: utg-base
3
- Version: 1.7.0
3
+ Version: 1.8.0
4
4
  Summary: UTG Base Package
5
5
  Author: Olimboy
6
6
  Author-email: shavkatov.olimboy@mail.ru
@@ -11,7 +11,7 @@ utg_base/authentications/__init__.py,sha256=a6twO_bBf8FAHYl7PXawfR2UbBwwdueG1uS_
11
11
  utg_base/authentications/microservice_authentication.py,sha256=6aAncxIpA4FcyRegd7QqRYvW5Wn8FxyPU0nQqCVuEs4,976
12
12
  utg_base/authentications/models.py,sha256=JQonSdXeSeoF003QlmPvH58nWmVJRKlWWjW_ySqXaYg,2496
13
13
  utg_base/celery/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- utg_base/celery/apps.py,sha256=eL9Il9gGLrtZtXOxWgQK1j8JH5g677h_He7Z1ldUiuA,151
14
+ utg_base/celery/apps.py,sha256=slwNufuKTuNGT3o9oV7MicERn5nh3FuL5OJirBC83Ys,156
15
15
  utg_base/celery/filters/__init__.py,sha256=wnkV8cPEvvHIl8OoMTv7fvSglDSFY8XxpCjUveRNUyg,45
16
16
  utg_base/celery/filters/task_result.py,sha256=iXgOrXrO8bvF9S47D53UzsdWQr_JrJ-LtxdjPfcTVjA,138
17
17
  utg_base/celery/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -31,6 +31,11 @@ utg_base/logging.py,sha256=JHGhuLKU1js_26ReE0LCLWZ66fmlGKuLG9sfbQSfI5w,4565
31
31
  utg_base/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  utg_base/middleware/debug.py,sha256=exkeYUK-zSN3PMd4L9F6WlROmQ7Qlpmi_Gr2dqt5vk4,416
33
33
  utg_base/middleware/locale.py,sha256=1hp_T_VuHCz0ITjwJ_F1rpf5kXQ0ulEmK1yoRWD1GRc,557
34
+ utg_base/migration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
+ utg_base/migration/apps.py,sha256=sATh5UNLRJeyFGiWTjU5L8qRSVM2NVG9GK196w6dd0A,162
36
+ utg_base/migration/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
+ utg_base/migration/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
+ utg_base/migration/management/commands/makemigrations.py,sha256=cV-YOjJry3MFP5WR5YYq8Ji1mW_wM0umBNjIb8Ts1zE,4513
34
39
  utg_base/models/__init__.py,sha256=1zXygGICiR3iUCKdkNal9d3i3kNp654gFgBf_VlR2gI,67
35
40
  utg_base/models/jwt_user.py,sha256=6TQ5wB_OZBtGhRL-2MonBGZm0n0Y86s4BRTxiRlUJOk,375
36
41
  utg_base/models/timestamp.py,sha256=AkCliNXnvs8Z17b1mcS7gOK7v6h3Jul6WCyGyVAkb-w,217
@@ -51,6 +56,6 @@ utg_base/utils/response_processors.py,sha256=WdZQL49wOJqCIY2MucAI6sez_llCqih0v_l
51
56
  utg_base/utils/sql.py,sha256=rqIWcSjdjIMszdRnsnhV5TTYB8W17RPOujIQA9rKC_Y,762
52
57
  utg_base/utils/thread.py,sha256=4RqRnwtyHymY-dNcuPrMSTamE2V7wCMVfzzyIb0P4TI,2191
53
58
  utg_base/utils/translation.py,sha256=GxJHUt0iar_0E7RWBPbeLFQ4DhgXBjffHCmxfKyjFtk,463
54
- utg_base-1.7.0.dist-info/METADATA,sha256=1XwqfOqDxhuzkk0Rfk5ZRjasjzBHIvYxfA2PuhFO9pk,871
55
- utg_base-1.7.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
56
- utg_base-1.7.0.dist-info/RECORD,,
59
+ utg_base-1.8.0.dist-info/METADATA,sha256=e7ukwTXgHmcSQ1ZIu9K6I3xJjSnCcMSuAkNtntBpPTY,871
60
+ utg_base-1.8.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
61
+ utg_base-1.8.0.dist-info/RECORD,,