# Path: stack_configs/influx_functions.py
# def getLastTimeInflux(index,device_id,channel_id):
#     logger.debug ('getting lasttime for device id: %s and channelid :%s',device_id,channel_id)
#     results=getLastInflux(index,device_id,channel_id)
#     datetime="error" 
#     for result in results:
#         logger.debug ('getLastInflux time result %s',result)
#         try:
#             datetime=parse_datetime(result['time'])  
#         except:
#             pass
#            
#     return datetime
# 
# Path: devices/models.py
# class Section(models.Model):
# class Device(models.Model):
# class Channel_tag(models.Model):
# class Channel(models.Model):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def last_published(self):


from django.contrib import admin
from stack_configs.influx_functions import getLastTimeInflux
from .models import Section,Device,Channel,User,Channel_tag
# Register your models here



class channelInline(admin.StackedInline):
    model = Channel
    #fields=['channel_id','last_published']
    readonly_fields=('last_published',)
    extra = 0
    

# Path: stack_configs/influx_functions.py
# def getLastTimeInflux(index,device_id,channel_id):
#     logger.debug ('getting lasttime for device id: %s and channelid :%s',device_id,channel_id)
#     results=getLastInflux(index,device_id,channel_id)
#     datetime="error" 
#     for result in results:
#         logger.debug ('getLastInflux time result %s',result)
#         try:
#             datetime=parse_datetime(result['time'])  
#         except:
#             pass
#            
#     return datetime
# 
# Path: devices/models.py
# class Section(models.Model):
# class Device(models.Model):
# class Channel_tag(models.Model):
# class Channel(models.Model):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def last_published(self):


# Path: devices/admin.py
from django.contrib import admin
from stack_configs.influx_functions import getLastTimeInflux
from .models import Section,Device,Channel,User,Channel_tag

# Register your models here



class channelInline(admin.StackedInline):
    model = Channel
    #fields=['channel_id','last_published']
    readonly_fields=('last_published',)
    extra = 0
    

    fieldsets = (