summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/orm/models.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-01-07 13:10:42 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-10 15:20:26 +0000
commit1b636173ca88e5ccca1992f9a12367a1189fa674 (patch)
tree0220e98e7b7a4027fb8c146bab9b3f81306fc9fe /bitbake/lib/toaster/orm/models.py
parent5482409a370552809de75150350defef04ac7144 (diff)
downloadpoky-1b636173ca88e5ccca1992f9a12367a1189fa674.tar.gz
bitbake: toaster: Toaster GUI, generic search, filter and order
This patch implements table searching, filtering and ordering, in a generic mode reusable for all tables. The search operates list of fields defined in the corresponding class for each model, search_allowed_fields. The search expression and filters are sent through GET requests using a QuerySet-like input. The inputs are filtered and validated before usage to prevent inadvertent or malicious use. Filters and table headers are defined in the views for each table, and rendered by generic code which is easily modified for various tables. The Build table and Configuration table are implemented using this framework as an example of how it should be used. [YOCTO #4249] [YOCTO #4254] [YOCTO #4255] [YOCTO #4256] [YOCTO #4257] [YOCTO #4259] [YOCTO #4260] (Bitbake rev: 2ca15117e4bbda38cda07511d0ff317273f91528) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/orm/models.py')
-rw-r--r--bitbake/lib/toaster/orm/models.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index b30e405c0e..ff26c7d436 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -31,8 +31,8 @@ class Build(models.Model):
31 (IN_PROGRESS, 'In Progress'), 31 (IN_PROGRESS, 'In Progress'),
32 ) 32 )
33 33
34 search_allowed_fields = ['machine', 34 search_allowed_fields = ['machine', 'image_fstypes',
35 'cooker_log_path'] 35 'cooker_log_path', "target__target"]
36 36
37 machine = models.CharField(max_length=100) 37 machine = models.CharField(max_length=100)
38 image_fstypes = models.CharField(max_length=100) 38 image_fstypes = models.CharField(max_length=100)
@@ -102,6 +102,8 @@ class Task(models.Model):
102 (OUTCOME_NA, 'Not Available'), 102 (OUTCOME_NA, 'Not Available'),
103 ) 103 )
104 104
105 search_allowed_fields = [ "recipe__name", "task_name" ]
106
105 build = models.ForeignKey(Build, related_name='task_build') 107 build = models.ForeignKey(Build, related_name='task_build')
106 order = models.IntegerField(null=True) 108 order = models.IntegerField(null=True)
107 task_executed = models.BooleanField(default=False) # True means Executed, False means Prebuilt 109 task_executed = models.BooleanField(default=False) # True means Executed, False means Prebuilt
@@ -217,6 +219,8 @@ class Layer_Version(models.Model):
217 219
218 220
219class Variable(models.Model): 221class Variable(models.Model):
222 search_allowed_fields = ['variable_name', 'variable_value',
223 'variablehistory__file_name', "description"]
220 build = models.ForeignKey(Build, related_name='variable_build') 224 build = models.ForeignKey(Build, related_name='variable_build')
221 variable_name = models.CharField(max_length=100) 225 variable_name = models.CharField(max_length=100)
222 variable_value = models.TextField(blank=True) 226 variable_value = models.TextField(blank=True)
@@ -225,7 +229,7 @@ class Variable(models.Model):
225 description = models.TextField(blank=True) 229 description = models.TextField(blank=True)
226 230
227class VariableHistory(models.Model): 231class VariableHistory(models.Model):
228 variable = models.ForeignKey(Variable) 232 variable = models.ForeignKey(Variable, related_name='vhistory')
229 file_name = models.FilePathField(max_length=255) 233 file_name = models.FilePathField(max_length=255)
230 line_number = models.IntegerField(null=True) 234 line_number = models.IntegerField(null=True)
231 operation = models.CharField(max_length=16) 235 operation = models.CharField(max_length=16)