# Path: salmon/metrics/models.py
# class Source(models.Model):
# class Metric(models.Model):
#     class Meta:
# class MetricGroup(Metric):
#     class Meta:
#     def __unicode__(self):
#     def get_absolute_url(self):
#     def __init__(self, *args, **kwargs):
#     def _reset_changes(self):
#     def whisper_filename(self):
#     def add_latest_to_archive(self):
#     def get_or_create_archive(self):
#     def load_archive(self, from_date, to_date=None):
#     def in_alert_state(self):
#     def get_value_display(self):
#     def time_between_updates(self):
#     def do_transform(self):
#     def do_counter_conversion(self):
#     def check_alarm(self):
#     def save(self, *args, **kwargs):
#     OPERATOR_CHOICES = (
#         ('lt', 'value < alert'),
#         ('le', 'value <= alert'),
#         ('eq', 'value == alert'),
#         ('ne', 'value != alert'),
#         ('ge', 'value >= alert'),
#         ('gt', 'value > alert'),
#     )
#     DISPLAY_CHOICES = (
#         ('float', 'Number'),
#         ('boolean', 'True/False'),
#         ('byte', 'Bytes'),
#         ('percentage', 'Percentage'),
#         ('second', 'Seconds'),
#     )


from django.contrib import admin
from . import models

class MetricAdmin(admin.ModelAdmin):
    search_fields = ('name',)
    list_filter = ('source',)
    list_display = ('name', 'source', 'last_updated', 'value_display',
                    'alert_triggered', 'display_as', 'is_counter', 'transform',
                    'alert_operator', 'alert_value')
    list_editable = ('display_as', 'is_counter',
                     'alert_operator', 'alert_value')


    def __init__(self, *args, **kwargs):
        super(MetricAdmin, self).__init__(*args, **kwargs)
        # Don't link to detail pages
        self.list_display_links = (None, )


# Path: salmon/metrics/models.py
# class Source(models.Model):
# class Metric(models.Model):
#     class Meta:
# class MetricGroup(Metric):
#     class Meta:
#     def __unicode__(self):
#     def get_absolute_url(self):
#     def __init__(self, *args, **kwargs):
#     def _reset_changes(self):
#     def whisper_filename(self):
#     def add_latest_to_archive(self):
#     def get_or_create_archive(self):
#     def load_archive(self, from_date, to_date=None):
#     def in_alert_state(self):
#     def get_value_display(self):
#     def time_between_updates(self):
#     def do_transform(self):
#     def do_counter_conversion(self):
#     def check_alarm(self):
#     def save(self, *args, **kwargs):
#     OPERATOR_CHOICES = (
#         ('lt', 'value < alert'),
#         ('le', 'value <= alert'),
#         ('eq', 'value == alert'),
#         ('ne', 'value != alert'),
#         ('ge', 'value >= alert'),
#         ('gt', 'value > alert'),
#     )
#     DISPLAY_CHOICES = (
#         ('float', 'Number'),
#         ('boolean', 'True/False'),
#         ('byte', 'Bytes'),
#         ('percentage', 'Percentage'),
#         ('second', 'Seconds'),
#     )


# Path: salmon/metrics/admin.py
from django.contrib import admin
from . import models


class MetricAdmin(admin.ModelAdmin):
    search_fields = ('name',)
    list_filter = ('source',)
    list_display = ('name', 'source', 'last_updated', 'value_display',
                    'alert_triggered', 'display_as', 'is_counter', 'transform',
                    'alert_operator', 'alert_value')
    list_editable = ('display_as', 'is_counter',
                     'alert_operator', 'alert_value')


    def __init__(self, *args, **kwargs):
        super(MetricAdmin, self).__init__(*args, **kwargs)
        # Don't link to detail pages
        self.list_display_links = (None, )


    def has_add_permission(self, request):