django-sql-explorer icon indicating copy to clipboard operation
django-sql-explorer copied to clipboard

`EXPLORER_PERMISSION_VIEW` and `EXPLORER_PERMISSION_CHANGE` violate PEP8

Open WillNilges opened this issue 1 year ago • 0 comments

I got a flake8 error when setting up the permission variables as the docs recommend:

https://django-sql-explorer.readthedocs.io/en/latest/settings.html#permission-view

Seems like it violates E731:

https://www.flake8rules.com/rules/E731.html

Instead, I did this:

def EXPLORER_PERMISSION_VIEW(r: HttpRequest) -> bool:
    return r.user.has_perm("meshapi.explorer_access")


def EXPLORER_PERMISSION_CHANGE(r: HttpRequest) -> bool:
    return r.user.has_perm("meshapi.explorer_access")

https://github.com/nycmeshnet/meshdb/blob/6f1d00a68e9b26ac5ffa9fb48386b0e23d26dcff/src/meshdb/settings.py#L413-L418

WillNilges avatar Sep 20 '24 01:09 WillNilges