Skip to content

Commit

Permalink
Merge pull request #1293 from Amsterdam/bugfix/sort-holiday-rental-fo…
Browse files Browse the repository at this point in the history
…r-created-date

Sort detailed registrations by creation date in descending order
  • Loading branch information
remyvdwereld authored Dec 31, 2024
2 parents 6675bd6 + 5603244 commit ba54fce
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/apps/addresses/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,13 @@ def registrations(self, request, bag_id):
except Exception as e:
print(f"Error fetching details for {registration_number}: {e}")

# Sort detailed_registrations by 'createdAt' with the newest first
detailed_registrations = sorted(
detailed_registrations,
key=lambda x: x.get("createdAt", ""),
reverse=True,
)

serializer = RegistrationDetailsSerializer(
detailed_registrations, many=True
)
Expand Down

0 comments on commit ba54fce

Please sign in to comment.