Skip to content
Snippets Groups Projects
Verified Commit b9967d9e authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

fix: ensure we use strings for the messages

parent 6d0da06c
No related branches found
No related tags found
No related merge requests found
Pipeline #7389 passed
......@@ -17,7 +17,7 @@ class Command(BaseCommand):
)
self.stdout.flush()
program_group.permissions.add(*app_permissions)
self.stdout.write(self.style.SUCCESS(len(app_permissions)))
self.stdout.write(self.style.SUCCESS(str(len(app_permissions))))
host_group = Group.objects.get(name=settings.ENTITLED_GROUPS[0])
model_permissions = Permission.objects.filter(
......@@ -29,7 +29,7 @@ class Command(BaseCommand):
)
self.stdout.flush()
host_group.permissions.add(*model_permissions)
self.stdout.write(self.style.SUCCESS(len(model_permissions)))
self.stdout.write(self.style.SUCCESS(str(len(model_permissions))))
host_plus_group = Group.objects.get(name=settings.ENTITLED_GROUPS[1])
change_permissions = Permission.objects.filter(
......@@ -40,7 +40,7 @@ class Command(BaseCommand):
ending="",
)
host_plus_group.permissions.add(*change_permissions)
self.stdout.write(self.style.SUCCESS(len(change_permissions)))
self.stdout.write(self.style.SUCCESS(str(len(change_permissions))))
self.stdout.flush()
edit_permissions = Permission.objects.filter(
codename__startswith="edit", content_type__model__in=["host", "note", "show"]
......@@ -51,7 +51,7 @@ class Command(BaseCommand):
)
self.stdout.flush()
host_plus_group.permissions.add(*edit_permissions)
self.stdout.write(self.style.SUCCESS(len(edit_permissions)))
self.stdout.write(self.style.SUCCESS(str(len(edit_permissions))))
self.stdout.write(
f"Adding edit permissions on host, note & show to the '{program_group}' group... ",
......@@ -59,4 +59,4 @@ class Command(BaseCommand):
)
self.stdout.flush()
program_group.permissions.add(*edit_permissions)
self.stdout.write(self.style.SUCCESS(len(edit_permissions)))
self.stdout.write(self.style.SUCCESS(str(len(edit_permissions))))
......@@ -60,11 +60,13 @@ class Command(BaseCommand):
if dry_run:
self.stdout.write(
self.style.WARNING(f"would add {len(timeslots)} timeslots to {schedule}")
self.style.WARNING(
f"would add {str(len(timeslots))} timeslots to {schedule}"
)
)
else:
TimeSlot.objects.bulk_create(timeslots, ignore_conflicts=True)
self.stdout.write(
self.style.SUCCESS(f"added {len(timeslots)} timeslots to {schedule}")
self.style.SUCCESS(f"added {str(len(timeslots))} timeslots to {schedule}")
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment