blob: feaa888c73ab06e772a05ce6ef2a0f2d2655aabf [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
2# SPDX-License-Identifier: GPL-2.0-only
3#
4
Patrick Williamsc124f4f2015-09-15 14:41:29 -05005from django.contrib import admin
Patrick Williamsc0f7c042017-02-23 20:41:17 -06006from orm.models import BitbakeVersion, Release, ToasterSetting, Layer_Version
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007from django import forms
8import django.db.models as models
9
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010
11class BitbakeVersionAdmin(admin.ModelAdmin):
12
Patrick Williamsc0f7c042017-02-23 20:41:17 -060013 # we override the formfield for db URLField
14 # because of broken URL validation
Patrick Williamsc124f4f2015-09-15 14:41:29 -050015
16 def formfield_for_dbfield(self, db_field, **kwargs):
17 if isinstance(db_field, models.fields.URLField):
18 return forms.fields.CharField()
Patrick Williamsc0f7c042017-02-23 20:41:17 -060019 return super(BitbakeVersionAdmin, self).formfield_for_dbfield(
20 db_field, **kwargs)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021
22
23class ReleaseAdmin(admin.ModelAdmin):
24 pass
25
Patrick Williamsc0f7c042017-02-23 20:41:17 -060026
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027class ToasterSettingAdmin(admin.ModelAdmin):
28 pass
29
Patrick Williamsc0f7c042017-02-23 20:41:17 -060030
31class LayerVersionsAdmin(admin.ModelAdmin):
32 pass
33
34admin.site.register(Layer_Version, LayerVersionsAdmin)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035admin.site.register(BitbakeVersion, BitbakeVersionAdmin)
36admin.site.register(Release, ReleaseAdmin)
37admin.site.register(ToasterSetting, ToasterSettingAdmin)