redirect sole warehouse (fixes #12716)
This commit is contained in:
parent
7a4b76c7fd
commit
afe0f1f167
|
@ -62,6 +62,13 @@ class HomepageView(AuthorizationMixin, TemplateView):
|
|||
key=lambda w: w.label)
|
||||
return ctx
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
ctx = self.get_context_data()['warehouses']
|
||||
if len(ctx) == 1:
|
||||
return HttpResponseRedirect(reverse('warehouse', kwargs={'warehouse': ctx[0].name}),
|
||||
status=307)
|
||||
return super(HomepageView, self).get(request, *args, **kwargs)
|
||||
|
||||
|
||||
class WarehouseView(AuthorizationMixin, TemplateView):
|
||||
template_name = 'bijoe/warehouse.html'
|
||||
|
|
Loading…
Reference in New Issue