all: general maintenance, prepare for pyright
This commit is contained in:
		@ -1,12 +0,0 @@
 | 
			
		||||
"""passbook django boilerplate code"""
 | 
			
		||||
from django.utils.decorators import method_decorator
 | 
			
		||||
from django.views.decorators.cache import never_cache
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class NeverCacheMixin:
 | 
			
		||||
    """Use never_cache as mixin for CBV"""
 | 
			
		||||
 | 
			
		||||
    @method_decorator(never_cache)
 | 
			
		||||
    def dispatch(self, *args, **kwargs):
 | 
			
		||||
        """Use never_cache as mixin for CBV"""
 | 
			
		||||
        return super().dispatch(*args, **kwargs)
 | 
			
		||||
@ -1,4 +1,5 @@
 | 
			
		||||
"""passbook util mixins"""
 | 
			
		||||
from django.views.decorators.cache import never_cache
 | 
			
		||||
from django.utils.decorators import method_decorator
 | 
			
		||||
from django.views.decorators.csrf import csrf_exempt
 | 
			
		||||
 | 
			
		||||
@ -10,3 +11,12 @@ class CSRFExemptMixin:
 | 
			
		||||
    def dispatch(self, *args, **kwargs):
 | 
			
		||||
        """wrapper to apply @csrf_exempt to CBV"""
 | 
			
		||||
        return super().dispatch(*args, **kwargs)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class NeverCacheMixin:
 | 
			
		||||
    """Use never_cache as mixin for CBV"""
 | 
			
		||||
 | 
			
		||||
    @method_decorator(never_cache)
 | 
			
		||||
    def dispatch(self, *args, **kwargs):
 | 
			
		||||
        """Use never_cache as mixin for CBV"""
 | 
			
		||||
        return super().dispatch(*args, **kwargs)
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user