Skip to content

Instantly share code, notes, and snippets.

@jaidetree
Last active October 3, 2018 20:37
Show Gist options
  • Select an option

  • Save jaidetree/488eaa2b69a16ca57aacba234a5ba212 to your computer and use it in GitHub Desktop.

Select an option

Save jaidetree/488eaa2b69a16ca57aacba234a5ba212 to your computer and use it in GitHub Desktop.
What is the best way to format this multi-line Python code?
# What is the best way to format this multi-line Python code?
#############################################################
self.queryset = self.queryset.filter(
Q(
name__istartswith=self.query_params.get('name')
) | Q(
venues__name__istartwith=self.query_params.get('name')
)
)
# In JavaScript I would do...
self.queryset = self.queryset
.filter(
Q(name__istartswith=self.query_params.get('name'))
| Q(venues__name__istartswith=self.query_params.get('name'))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment