Minor building fix.
[wolnelektury.git] / src / club / views.py
index d673cc0..6a5c7d7 100644 (file)
@@ -43,10 +43,6 @@ class JoinView(CreateView):
             request.session['from_app'] = True
         elif request.session and 'from_app' in request.session:
             del request.session['from_app']
             request.session['from_app'] = True
         elif request.session and 'from_app' in request.session:
             del request.session['from_app']
-        #schedule = get_active_schedule(request.user)
-        #if schedule is not None:
-        #    return HttpResponseRedirect(schedule.get_absolute_url())
-        #else:
         return super(JoinView, self).get(request)
 
     def get_context_data(self, **kwargs):
         return super(JoinView, self).get(request)
 
     def get_context_data(self, **kwargs):
@@ -64,6 +60,11 @@ class JoinView(CreateView):
                 'email': self.request.user.email,
             }
 
                 'email': self.request.user.email,
             }
 
+    def get_form_kwargs(self):
+        kwargs = super().get_form_kwargs()
+        kwargs['referer'] = self.request.META.get('HTTP_REFERER', '')
+        return kwargs
+
     def form_valid(self, form):
         retval = super(JoinView, self).form_valid(form)
         if self.request.user.is_authenticated:
     def form_valid(self, form):
         retval = super(JoinView, self).form_valid(form)
         if self.request.user.is_authenticated: