Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Remove instances of *.objects.all()[0] #255

Open
justinrporter opened this issue Jan 23, 2020 · 0 comments
Open

Remove instances of *.objects.all()[0] #255

justinrporter opened this issue Jan 23, 2020 · 0 comments

Comments

@justinrporter
Copy link
Member

justinrporter commented Jan 23, 2020

There are a few instances in the code of using *.objects.all()[0] instead of *.objects.first(). This is an antipattern, but because there are examples of it, people take it to heart.

Using grep, you should be able to identify all instances of this (e.g. grep 'all()\[0\]' $( find . -name '*.py' )).

Using find and replace with sed (linux, macos), you can fix it in bulk.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant