def display_state(self, ticket): """ State colored for change_form """ return colored('state', STATE_COLORS, bold=False, verbose=True)(ticket)
def colored_priority(self, instance): return colored('priority', PRIORITY_COLORS, bold=False)(instance)
def display_priority(self, ticket): """ State colored for change_form """ return colored('priority', PRIORITY_COLORS, bold=False, verbose=True)(ticket)
def colored_state(instance): color = colored('state', STATE_COLORS) return mark_safe(color(instance))
def colored_state(self, instance): return colored('state', STATE_COLORS, bold=False)(instance)
def display_set_state(self, node): return colored('set_state', STATES_COLORS, verbose=True, bold=False)(node)
log_sliver_history, remove_slice_id, state_value, wrap_action) from .models import (Slice, SliceProp, Sliver, SliverDefaults, SliverProp, SliverIface, Template) # List of ifaces displayed in SliverInline (and subclasses) SLIVER_IFACES = ['public6', 'public4', 'management', 'isolated', 'debug'] STATE_COLORS = { Slice.REGISTER: 'grey', Slice.DEPLOY: 'darkorange', Slice.START: 'green' } colored_set_state = colored('set_state', STATE_COLORS, verbose=True, bold=False) def num_slivers(instance): """ return num slivers as a link to slivers changelist view """ num = instance.slivers.count() url = reverse('admin:slices_sliver_changelist') url += '?my_slivers=False&%s=%s' % (instance._meta.model_name, instance.pk) return mark_safe('<a href="%s">%d</a>' % (url, num)) num_slivers.short_description = 'Slivers' num_slivers.admin_order_field = 'slivers__count'
log_sliver_history, remove_slice_id, state_value, wrap_action) from .models import (Slice, SliceProp, Sliver, SliverDefaults, SliverProp, SliverIface, Template) # List of ifaces displayed in SliverInline (and subclasses) SLIVER_IFACES = ['public6', 'public4', 'management', 'isolated', 'debug'] STATE_COLORS = { Slice.REGISTER: 'grey', Slice.DEPLOY: 'darkorange', Slice.START: 'green' } colored_set_state = colored('set_state', STATE_COLORS, verbose=True, bold=False) def num_slivers(instance): """ return num slivers as a link to slivers changelist view """ num = instance.slivers.count() url = reverse('admin:slices_sliver_changelist') url += '?my_slivers=False&%s=%s' % (instance._meta.model_name, instance.pk) return mark_safe('<a href="%s">%d</a>' % (url, num)) num_slivers.short_description = 'Slivers' num_slivers.admin_order_field = 'slivers__count' def computed_sliver_set_state(sliver): title = '' # compute if state is overridden...
def display_value(self, instance): value = colored('value', STATES_COLORS, verbose=True)(instance) url = reverse('admin:state_history_data', args=[instance.pk]) return mark_safe('<a class="show-popup" href="#" url="%s">%s</a>' % (url, value))
def colored_state(self, build): return colored('state', STATE_COLORS)(build)