This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import HttpResponseRedirect | |
from django.core.exceptions import PermissionDenied | |
from django.urls import reverse | |
from django.shortcuts import render | |
from django.shortcuts import redirect | |
def role_required(allowed_roles=[]): | |
def decorator(view_func): | |
def wrap(request, *args, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
async def worker(name, number_of_hours): | |
for i in range(number_of_hours): | |
await asyncio.sleep(1) | |
print(f"@20 - Worker {name} is working {i + 1} hours...") | |
async def workers(): | |
# Schedule three calls *concurrently*: | |
print('@10 - 3 workers will start working') |
OlderNewer