diff --git a/postcodes/management/commands/loadpostcodeconcordance.py b/postcodes/management/commands/loadpostcodeconcordance.py index 4d64ab0..bb7d7d7 100644 --- a/postcodes/management/commands/loadpostcodeconcordance.py +++ b/postcodes/management/commands/loadpostcodeconcordance.py @@ -58,7 +58,7 @@ def handle(self, *args, **options): try: (postcode, created) = Postcode.objects.get_or_create(code=code) except ValidationError as e: - log.error("{}: {!r}".format(code, e)) + log.error("%s: %s", code, repr(e)) continue try: @@ -70,12 +70,12 @@ def handle(self, *args, **options): boundary = boundaries.get(**{options['search-field']: term}) boundaries_seen[term] = boundary except Boundary.DoesNotExist: - log.error("No boundary {} matches {}".format(options['search-field'], term)) + log.error("No boundary %s matches %s", options['search-field'], term) continue - path = '{}/{}'.format(boundary_set.slug, boundary.slug) + path = f'{boundary_set.slug}/{boundary.slug}' if PostcodeConcordance.objects.filter(code=postcode, boundary=path).exists(): - log.warning("Concordance already exists between {} and {}".format(code, path)) + log.warning("Concordance already exists between %s and %s", code, path) continue PostcodeConcordance.objects.create( diff --git a/postcodes/management/commands/loadpostcodes.py b/postcodes/management/commands/loadpostcodes.py index bbe3022..c395b63 100644 --- a/postcodes/management/commands/loadpostcodes.py +++ b/postcodes/management/commands/loadpostcodes.py @@ -36,4 +36,4 @@ def handle(self, *args, **options): province=row['region'], ).save() except ValidationError as e: - log.error("{}: {!r}".format(row['code'], e)) + log.error("%s: %s", row['code'], repr(e)) diff --git a/postcodes/models.py b/postcodes/models.py index 92b04e3..0446233 100644 --- a/postcodes/models.py +++ b/postcodes/models.py @@ -158,4 +158,4 @@ class Meta: unique_together = (('code', 'boundary')) def __str__(self): - return '{} -> {}'.format(self.code_id, self.boundary) + return f'{self.code_id} -> {self.boundary}'