mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
python: Normalize quotes with Black.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
11741543da
commit
6e4c3e41dc
@@ -7,8 +7,8 @@ from django.db.migrations.state import StateApps
|
||||
|
||||
|
||||
def move_to_seperate_table(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
||||
UserProfile = apps.get_model('zerver', 'UserProfile')
|
||||
AlertWord = apps.get_model('zerver', 'AlertWord')
|
||||
UserProfile = apps.get_model("zerver", "UserProfile")
|
||||
AlertWord = apps.get_model("zerver", "AlertWord")
|
||||
|
||||
for user_profile in UserProfile.objects.all():
|
||||
list_of_words = orjson.loads(user_profile.alert_words)
|
||||
@@ -25,8 +25,8 @@ def move_to_seperate_table(apps: StateApps, schema_editor: DatabaseSchemaEditor)
|
||||
|
||||
|
||||
def move_back_to_user_profile(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
||||
AlertWord = apps.get_model('zerver', 'AlertWord')
|
||||
UserProfile = apps.get_model('zerver', 'UserProfile')
|
||||
AlertWord = apps.get_model("zerver", "AlertWord")
|
||||
UserProfile = apps.get_model("zerver", "UserProfile")
|
||||
|
||||
user_ids_and_words = AlertWord.objects.all().values("user_profile_id", "word")
|
||||
user_ids_with_words: Dict[int, List[str]] = {}
|
||||
@@ -38,13 +38,13 @@ def move_back_to_user_profile(apps: StateApps, schema_editor: DatabaseSchemaEdit
|
||||
for (user_id, words) in user_ids_with_words.items():
|
||||
user_profile = UserProfile.objects.get(id=user_id)
|
||||
user_profile.alert_words = orjson.dumps(words).decode()
|
||||
user_profile.save(update_fields=['alert_words'])
|
||||
user_profile.save(update_fields=["alert_words"])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('zerver', '0276_alertword'),
|
||||
("zerver", "0276_alertword"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
||||
Reference in New Issue
Block a user