Pagination in the admin
This commit is contained in:
parent
489ed6cbe0
commit
d4c80dedeb
8 changed files with 112 additions and 29 deletions
12
app/utils/pagination.py
Normal file
12
app/utils/pagination.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
import base64
|
||||
from datetime import datetime
|
||||
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
|
||||
def encode_cursor(val: datetime) -> str:
|
||||
return base64.urlsafe_b64encode(val.isoformat().encode()).decode()
|
||||
|
||||
|
||||
def decode_cursor(cursor: str) -> datetime:
|
||||
return isoparse(base64.urlsafe_b64decode(cursor).decode())
|
Loading…
Add table
Add a link
Reference in a new issue