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): ...@@ -17,7 +17,7 @@ class Command(BaseCommand):
) )
self.stdout.flush() self.stdout.flush()
program_group.permissions.add(*app_permissions) 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]) host_group = Group.objects.get(name=settings.ENTITLED_GROUPS[0])
model_permissions = Permission.objects.filter( model_permissions = Permission.objects.filter(
...@@ -29,7 +29,7 @@ class Command(BaseCommand): ...@@ -29,7 +29,7 @@ class Command(BaseCommand):
) )
self.stdout.flush() self.stdout.flush()
host_group.permissions.add(*model_permissions) 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]) host_plus_group = Group.objects.get(name=settings.ENTITLED_GROUPS[1])
change_permissions = Permission.objects.filter( change_permissions = Permission.objects.filter(
...@@ -40,7 +40,7 @@ class Command(BaseCommand): ...@@ -40,7 +40,7 @@ class Command(BaseCommand):
ending="", ending="",
) )
host_plus_group.permissions.add(*change_permissions) 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() self.stdout.flush()
edit_permissions = Permission.objects.filter( edit_permissions = Permission.objects.filter(
codename__startswith="edit", content_type__model__in=["host", "note", "show"] codename__startswith="edit", content_type__model__in=["host", "note", "show"]
...@@ -51,7 +51,7 @@ class Command(BaseCommand): ...@@ -51,7 +51,7 @@ class Command(BaseCommand):
) )
self.stdout.flush() self.stdout.flush()
host_plus_group.permissions.add(*edit_permissions) 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( self.stdout.write(
f"Adding edit permissions on host, note & show to the '{program_group}' group... ", f"Adding edit permissions on host, note & show to the '{program_group}' group... ",
...@@ -59,4 +59,4 @@ class Command(BaseCommand): ...@@ -59,4 +59,4 @@ class Command(BaseCommand):
) )
self.stdout.flush() self.stdout.flush()
program_group.permissions.add(*edit_permissions) 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): ...@@ -60,11 +60,13 @@ class Command(BaseCommand):
if dry_run: if dry_run:
self.stdout.write( 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: else:
TimeSlot.objects.bulk_create(timeslots, ignore_conflicts=True) TimeSlot.objects.bulk_create(timeslots, ignore_conflicts=True)
self.stdout.write( 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