from django.contrib import admin from .models import * class LandAdmin(admin.ModelAdmin): list_display = ('id', 'name', 'code', 'the_geom') search_fields = ('name', ) class ProbeAdmin(admin.ModelAdmin): list_display = ('id', 'name', 'code', 'drilling') search_fields = ('name', ) class DrillingAdmin(admin.ModelAdmin): list_display = ('id', 'name', 'code', 'section') search_fields = ('name', 'section__name',) class EquipmentAdmin(admin.ModelAdmin): list_display = ('id', 'name', 'code', 'land') search_fields = ('name', ) class SectionAdmin(admin.ModelAdmin): list_display = ('id', 'name', 'code', 'land', 'owner') search_fields = ('land__name', ) class ProbeDataAdmin(admin.ModelAdmin): list_display = ('id', 'recorded', 'value1', 'value2') search_fields = ('recorded',) class SourcesAdmin(admin.ModelAdmin): list_display = ('id', 'filename') search_fields = ('filename', ) class SoilTestAdmin(admin.ModelAdmin): list_display = ('drilling_code', 'sample_code', 'drilling') search_fields = ('drilling_code',) class MeteorologicalImageInline(admin.StackedInline): model = MeteorologicalImage extra = 5 class MeteorologicalAdmin(admin.ModelAdmin): inlines = [MeteorologicalImageInline] list_display = ('id', 'title') search_fields = ('title',) admin.site.register(SoilTest, SoilTestAdmin) admin.site.register(Sources, SourcesAdmin) admin.site.register(Land, LandAdmin) admin.site.register(Probe, ProbeAdmin) admin.site.register(Drilling, DrillingAdmin) admin.site.register(Section, SectionAdmin) admin.site.register(Equipment, EquipmentAdmin) admin.site.register(ProbeData, ProbeDataAdmin) admin.site.register(Meteorological, MeteorologicalAdmin)