construct values in queryset instead of serializer methods

This commit is contained in:
smilerz
2022-01-11 07:24:59 -06:00
parent 30683fe455
commit f7cb067b52
5 changed files with 82 additions and 40 deletions

View File

@ -13,19 +13,20 @@ class CustomRemoteUser(RemoteUserMiddleware):
Gist code by vstoykov, you can check his original gist at:
https://gist.github.com/vstoykov/1390853/5d2e8fac3ca2b2ada8c7de2fb70c021e50927375
Changes:
Ignoring static file requests and a certain useless admin request from triggering the logger.
Ignoring static file requests and a certain useless admin request from triggering the logger.
Updated statements to make it Python 3 friendly.
"""
def terminal_width():
"""
Function to compute the terminal width.
"""
width = 0
try:
import struct, fcntl, termios
import fcntl
import struct
import termios
s = struct.pack('HHHH', 0, 0, 0, 0)
x = fcntl.ioctl(1, termios.TIOCGWINSZ, s)
width = struct.unpack('HHHH', x)[1]