summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index d675f4f2d2..6ebb6a927a 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -71,14 +71,24 @@ class MimeTypeFinder(object):
71# all new sessions should come through the landing page; 71# all new sessions should come through the landing page;
72# determine in which mode we are running in, and redirect appropriately 72# determine in which mode we are running in, and redirect appropriately
73def landing(request): 73def landing(request):
74 # in build mode, we redirect to the command-line builds page
75 # if there are any builds for the default (cli builds) project
76 default_project = Project.objects.get_default_project()
77 default_project_builds = Build.objects.filter(project = default_project)
78
79 if (not toastermain.settings.BUILD_MODE) and default_project_builds.count() > 0:
80 args = (default_project.id,)
81 return redirect(reverse('projectbuilds', args = args), permanent = False)
82
74 # we only redirect to projects page if there is a user-generated project 83 # we only redirect to projects page if there is a user-generated project
84 num_builds = Build.objects.all().count()
75 user_projects = Project.objects.filter(is_default = False) 85 user_projects = Project.objects.filter(is_default = False)
76 has_user_project = user_projects.count() > 0 86 has_user_project = user_projects.count() > 0
77 87
78 if Build.objects.count() == 0 and has_user_project: 88 if num_builds == 0 and has_user_project:
79 return redirect(reverse('all-projects'), permanent = False) 89 return redirect(reverse('all-projects'), permanent = False)
80 90
81 if Build.objects.all().count() > 0: 91 if num_builds > 0:
82 return redirect(reverse('all-builds'), permanent = False) 92 return redirect(reverse('all-builds'), permanent = False)
83 93
84 context = {'lvs_nos' : Layer_Version.objects.all().count()} 94 context = {'lvs_nos' : Layer_Version.objects.all().count()}