blob: 1f2e07f50bf93041b0b4064f463ae9e58cea8edb [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001from django.contrib import admin
Patrick Williamsc0f7c042017-02-23 20:41:17 -06002from orm.models import BitbakeVersion, Release, ToasterSetting, Layer_Version
Patrick Williamsc124f4f2015-09-15 14:41:29 -05003from django import forms
4import django.db.models as models
5
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006
7class BitbakeVersionAdmin(admin.ModelAdmin):
8
Patrick Williamsc0f7c042017-02-23 20:41:17 -06009 # we override the formfield for db URLField
10 # because of broken URL validation
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011
12 def formfield_for_dbfield(self, db_field, **kwargs):
13 if isinstance(db_field, models.fields.URLField):
14 return forms.fields.CharField()
Patrick Williamsc0f7c042017-02-23 20:41:17 -060015 return super(BitbakeVersionAdmin, self).formfield_for_dbfield(
16 db_field, **kwargs)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017
18
19class ReleaseAdmin(admin.ModelAdmin):
20 pass
21
Patrick Williamsc0f7c042017-02-23 20:41:17 -060022
Patrick Williamsc124f4f2015-09-15 14:41:29 -050023class ToasterSettingAdmin(admin.ModelAdmin):
24 pass
25
Patrick Williamsc0f7c042017-02-23 20:41:17 -060026
27class LayerVersionsAdmin(admin.ModelAdmin):
28 pass
29
30admin.site.register(Layer_Version, LayerVersionsAdmin)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050031admin.site.register(BitbakeVersion, BitbakeVersionAdmin)
32admin.site.register(Release, ReleaseAdmin)
33admin.site.register(ToasterSetting, ToasterSettingAdmin)