workout/gym/mixins.py

17 lines
481 B
Python
Raw Normal View History

class SessionResetMixin:
def dispatch(self, request, *args, **kwargs):
2019-06-23 15:39:13 +02:00
if "session_pk" in request.session:
del request.session["session_pk"]
return super().dispatch(request, *args, **kwargs)
2018-03-04 21:45:50 +01:00
class QuickActionsMixin:
def get_quick_actions(self):
return []
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
2019-06-23 15:39:13 +02:00
context["quick_actions"] = self.get_quick_actions()
2018-03-04 21:45:50 +01:00
return context