Spaces:
Sleeping
Sleeping
Download server/templates/level_6/view.py from anonajay/lint_coding_agent: direct link, hf CLI and curl.
- Browser
- Download file 430 Bytes
-
https://huggingface.co/spaces/anonajay/lint_coding_agent/resolve/main/server/templates/level_6/view.py
- Command line
-
hf download hf://spaces/anonajay/lint_coding_agent/server/templates/level_6/view.py
-
curl -L -o view.py https://huggingface.co/spaces/anonajay/lint_coding_agent/resolve/main/server/templates/level_6/view.py
430 Bytes
| from .models import Post | |
| def get_post_data(): | |
| # BROKEN: This is the N+1 trigger. | |
| # It fetches posts, but not the related authors. | |
| posts = Post.objects.all() | |
| results = [] | |
| for post in posts: | |
| # Each access of 'post.author' triggers a NEW database hit! | |
| results.append({ | |
| 'title': post.title, | |
| 'author_name': post.author.name | |
| }) | |
| return results |