diff options
-rw-r--r-- | bitbake/lib/toaster/orm/models.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 68c3072991..f0a8786640 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -264,11 +264,17 @@ class Project(models.Model): | |||
264 | def get_all_compatible_layer_versions(self): | 264 | def get_all_compatible_layer_versions(self): |
265 | """ Returns Queryset of all Layer_Versions which are compatible with | 265 | """ Returns Queryset of all Layer_Versions which are compatible with |
266 | this project""" | 266 | this project""" |
267 | queryset = Layer_Version.objects.filter( | 267 | queryset = None |
268 | (Q(up_branch__name=self.release.branch_name) & | 268 | |
269 | Q(build=None) & | 269 | # guard on release, as it can be null |
270 | Q(project=None)) | | 270 | if self.release: |
271 | Q(project=self)) | 271 | queryset = Layer_Version.objects.filter( |
272 | (Q(up_branch__name=self.release.branch_name) & | ||
273 | Q(build=None) & | ||
274 | Q(project=None)) | | ||
275 | Q(project=self)) | ||
276 | else: | ||
277 | queryset = Layer_Version.objects.none() | ||
272 | 278 | ||
273 | return queryset | 279 | return queryset |
274 | 280 | ||