[Toaster] [review-request][PATCH 3/6] toaster: Only redirect to projects page if user has added projects
Elliot Smith
elliot.smith at intel.com
Wed Sep 2 01:56:51 PDT 2015
The landing page currently redirects the user if there are any
projects in the db. Because we now always have at least one
(the default one added by a migration), we always get the redirect.
Change this so that when the user hits the landing page,
we only redirect them to the projects page if there is at least
one user-added project and there are no builds.
[YOCTO #7932]
Signed-off-by: Elliot Smith <elliot.smith at intel.com>
---
bitbake/lib/toaster/toastergui/views.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index c583d96..6c73eb4 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -54,7 +54,11 @@ logger = logging.getLogger("toaster")
# all new sessions should come through the landing page;
# determine in which mode we are running in, and redirect appropriately
def landing(request):
- if Build.objects.count() == 0 and Project.objects.count() > 0:
+ # we only redirect to projects page if there is a user-generated project
+ user_projects = Project.objects.filter(is_default = False)
+ has_user_project = user_projects.count() > 0
+
+ if Build.objects.count() == 0 and has_user_project:
return redirect(reverse('all-projects'), permanent = False)
if Build.objects.all().count() > 0:
--
Elliot Smith
Software Engineer
Intel OTC
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
More information about the toaster
mailing list