Skip to content

Commit

Permalink
Explain slice assignment syntax and purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkb committed May 30, 2024
1 parent e799814 commit 90b9fbe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/api/admin/media_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ def wrapper(*args, **kwargs):
# End of block lifted from Django source.

urls = super().get_urls()

# Using slice assignment (docs:
# https://docs.python.org/3/tutorial/introduction.html#lists),
# insert custom URLs at the penultimate position so that they
# appear just before the catch-all view.
urls[-1:-1] = [
path(
"<path:object_id>/moderate/",
Expand Down

0 comments on commit 90b9fbe

Please sign in to comment.