37 lines
		
	
	
	
		
			819 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
	
		
			819 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from django.conf import settings
 | |
| 
 | |
| 
 | |
| def april(req):
 | |
| 	if 'X-April' in req.headers:
 | |
| 		try:
 | |
| 			year = int(req.headers['X-April'])
 | |
| 			return {'april': year}
 | |
| 		except:
 | |
| 			pass # Fall-back to regular behaviour
 | |
| 	
 | |
| 	import datetime
 | |
| 	today = datetime.date.today()
 | |
| 	if today.day == 1 and today.month == 4:
 | |
| 		return {'april': today.year}
 | |
| 	return {}
 | |
| 
 | |
| def halloween(req):
 | |
| 	if 'X-Halloween' in req.headers:
 | |
| 		try:
 | |
| 			year = int(req.headers['X-Halloween'])
 | |
| 			return {'halloween': year}
 | |
| 		except:
 | |
| 			pass # Fall-back to regular behaviour
 | |
| 	
 | |
| 	import datetime
 | |
| 	today = datetime.date.today()
 | |
| 	if today.month == 10 and today.day >= 25:
 | |
| 		return {'halloween': today.year}
 | |
| 	return {}
 | |
| 
 | |
| def rozliseni(request):
 | |
| 	ltp = settings.LOCAL_TEST_PROD
 | |
| 	if request.user.is_superuser and ltp == "prod":
 | |
| 		ltp = "su" + ltp
 | |
| 	return {"LOCAL_TEST_PROD": ltp}
 | |
| 
 |