summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/toaster/orm/models.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index bb018a9819..30599088e5 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -20,6 +20,7 @@
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 21
22from django.db import models 22from django.db import models
23from django.db.models import F
23from django.utils.encoding import python_2_unicode_compatible 24from django.utils.encoding import python_2_unicode_compatible
24 25
25 26
@@ -211,6 +212,12 @@ class Package(models.Model):
211 section = models.CharField(max_length=80, blank=True) 212 section = models.CharField(max_length=80, blank=True)
212 license = models.CharField(max_length=80, blank=True) 213 license = models.CharField(max_length=80, blank=True)
213 214
215class Package_DependencyManager(models.Manager):
216 use_for_related_fields = True
217
218 def get_query_set(self):
219 return super(Package_DependencyManager, self).get_query_set().exclude(package_id = F('depends_on__id'))
220
214class Package_Dependency(models.Model): 221class Package_Dependency(models.Model):
215 TYPE_RDEPENDS = 0 222 TYPE_RDEPENDS = 0
216 TYPE_TRDEPENDS = 1 223 TYPE_TRDEPENDS = 1
@@ -250,6 +257,7 @@ class Package_Dependency(models.Model):
250 depends_on = models.ForeignKey(Package, related_name='package_dependencies_target') # soft dependency 257 depends_on = models.ForeignKey(Package, related_name='package_dependencies_target') # soft dependency
251 dep_type = models.IntegerField(choices=DEPENDS_TYPE) 258 dep_type = models.IntegerField(choices=DEPENDS_TYPE)
252 target = models.ForeignKey(Target, null=True) 259 target = models.ForeignKey(Target, null=True)
260 objects = Package_DependencyManager()
253 261
254class Target_Installed_Package(models.Model): 262class Target_Installed_Package(models.Model):
255 target = models.ForeignKey(Target) 263 target = models.ForeignKey(Target)
@@ -273,6 +281,11 @@ class Recipe(models.Model):
273 bugtracker = models.URLField(blank=True) 281 bugtracker = models.URLField(blank=True)
274 file_path = models.FilePathField(max_length=255) 282 file_path = models.FilePathField(max_length=255)
275 283
284class Recipe_DependencyManager(models.Manager):
285 use_for_related_fields = True
286
287 def get_query_set(self):
288 return super(Recipe_DependencyManager, self).get_query_set().exclude(recipe_id = F('depends_on__id'))
276 289
277class Recipe_Dependency(models.Model): 290class Recipe_Dependency(models.Model):
278 TYPE_DEPENDS = 0 291 TYPE_DEPENDS = 0
@@ -285,6 +298,7 @@ class Recipe_Dependency(models.Model):
285 recipe = models.ForeignKey(Recipe, related_name='r_dependencies_recipe') 298 recipe = models.ForeignKey(Recipe, related_name='r_dependencies_recipe')
286 depends_on = models.ForeignKey(Recipe, related_name='r_dependencies_depends') 299 depends_on = models.ForeignKey(Recipe, related_name='r_dependencies_depends')
287 dep_type = models.IntegerField(choices=DEPENDS_TYPE) 300 dep_type = models.IntegerField(choices=DEPENDS_TYPE)
301 objects = Recipe_DependencyManager()
288 302
289class Layer(models.Model): 303class Layer(models.Model):
290 name = models.CharField(max_length=100) 304 name = models.CharField(max_length=100)