diff options
Diffstat (limited to 'apps/utils/views.py')
-rw-r--r-- | apps/utils/views.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/utils/views.py b/apps/utils/views.py index c752706..677ac4b 100644 --- a/apps/utils/views.py +++ b/apps/utils/views.py @@ -4,6 +4,7 @@ from django.http import Http404, HttpResponse, JsonResponse from django.apps import apps from django.views.generic import ListView from django.views.generic.base import View, RedirectView +from django.views.generic.edit import FormView, ModelFormMixin from django.utils.decorators import method_decorator from django.contrib.auth.decorators import login_required #from photos.models import LuxImage, LuxVideo @@ -42,6 +43,14 @@ class LoggedInViewWithUser(View): return kwargs +@method_decorator(login_required, name='dispatch') +class LoggedInViewWithUser(FormView): + + def get_form_kwargs(self, **kwargs): + kwargs = super().get_form_kwargs(**kwargs) + kwargs.update({'user': self.request.user}) + return kwargs + class AjaxableResponseMixin: """ |