[gnome-continuous-yocto/gnomeostree-3.28-rocko: 1512/8267] bitbake: toaster: admin Add Layer_Version to the admin-able models
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 1512/8267] bitbake: toaster: admin Add Layer_Version to the admin-able models
- Date: Sat, 16 Dec 2017 21:55:53 +0000 (UTC)
commit 04d1ad5fe7f5029a5b46a10ef18f7f335c17474b
Author: Michael Wood <michael g wood intel com>
Date: Thu Jul 21 14:43:31 2016 +0100
bitbake: toaster: admin Add Layer_Version to the admin-able models
If the migration didn't get the release conversion right for say, a
local or imported layer it would be handy to be able to edit this
in the django admin page.
Also useful for developers to be able to tweak layers on the fly.
(Bitbake rev: 0b23b6919ef1162a0c7fb5b5a961a24653c51eb2)
Signed-off-by: Michael Wood <michael g wood intel com>
Signed-off-by: Elliot Smith <elliot smith intel com>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
bitbake/lib/toaster/bldcollector/admin.py | 18 +++++++++++-------
bitbake/lib/toaster/orm/models.py | 11 +++++++++++
2 files changed, 22 insertions(+), 7 deletions(-)
---
diff --git a/bitbake/lib/toaster/bldcollector/admin.py b/bitbake/lib/toaster/bldcollector/admin.py
index 7b69ecd..1f2e07f 100644
--- a/bitbake/lib/toaster/bldcollector/admin.py
+++ b/bitbake/lib/toaster/bldcollector/admin.py
@@ -1,29 +1,33 @@
from django.contrib import admin
-from django.contrib.admin.filters import RelatedFieldListFilter
-from orm.models import BitbakeVersion, Release, ToasterSetting
-from django.forms.widgets import Textarea
+from orm.models import BitbakeVersion, Release, ToasterSetting, Layer_Version
from django import forms
import django.db.models as models
-from django.contrib.admin import widgets, helpers
class BitbakeVersionAdmin(admin.ModelAdmin):
- # we override the formfield for db URLField because of broken URL validation
+ # we override the formfield for db URLField
+ # because of broken URL validation
def formfield_for_dbfield(self, db_field, **kwargs):
if isinstance(db_field, models.fields.URLField):
return forms.fields.CharField()
- return super(BitbakeVersionAdmin, self).formfield_for_dbfield(db_field, **kwargs)
-
+ return super(BitbakeVersionAdmin, self).formfield_for_dbfield(
+ db_field, **kwargs)
class ReleaseAdmin(admin.ModelAdmin):
pass
+
class ToasterSettingAdmin(admin.ModelAdmin):
pass
+
+class LayerVersionsAdmin(admin.ModelAdmin):
+ pass
+
+admin.site.register(Layer_Version, LayerVersionsAdmin)
admin.site.register(BitbakeVersion, BitbakeVersionAdmin)
admin.site.register(Release, ReleaseAdmin)
admin.site.register(ToasterSetting, ToasterSettingAdmin)
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 72b9dfe..caacc2a 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -1252,6 +1252,9 @@ class Release(models.Model):
def __unicode__(self):
return "%s (%s)" % (self.name, self.branch_name)
+ def __str__(self):
+ return self.name
+
class ReleaseDefaultLayer(models.Model):
release = models.ForeignKey(Release)
layer_name = models.CharField(max_length=100, default="")
@@ -1419,6 +1422,14 @@ class Layer_Version(models.Model):
def __unicode__(self):
return ("id %d belongs to layer: %s" % (self.pk, self.layer.name))
+ def __str__(self):
+ if self.release:
+ release = self.release.name
+ else:
+ release = "No release set"
+
+ return "%d %s (%s)" % (self.pk, self.layer.name, release)
+
class LayerVersionDependency(models.Model):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]