<s> from django . db import models <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from ralph . admin . autocomplete import AutocompleteTooltipMixin <EOL> from ralph . assets . models . base import BaseObject <EOL> from ralph . assets . models . choices import ComponentType <EOL> from ralph . lib . mixins . fields import NullableCharField <EOL> from ralph . lib . mixins . models import NamedMixin <EOL> class ComponentModel ( AutocompleteTooltipMixin , NamedMixin , models . Model ) : <EOL> speed = models . PositiveIntegerField ( <EOL> verbose_name = _ ( '<STR_LIT>' ) , <EOL> default = <NUM_LIT:0> , <EOL> blank = True , <EOL> ) <EOL> cores = models . PositiveIntegerField ( <EOL> verbose_name = _ ( '<STR_LIT>' ) , <EOL> default = <NUM_LIT:0> , <EOL> blank = True , <EOL> ) <EOL> size = models . PositiveIntegerField ( <EOL> verbose_name = _ ( '<STR_LIT>' ) , <EOL> default = <NUM_LIT:0> , <EOL> blank = True , <EOL> ) <EOL> type = models . PositiveIntegerField ( <EOL> verbose_name = _ ( '<STR_LIT>' ) , <EOL> choices = ComponentType ( ) , <EOL> default = ComponentType . unknown . id , <EOL> ) <EOL> family = models . CharField ( blank = True , default = '<STR_LIT>' , max_length = <NUM_LIT> ) <EOL> autocomplete_tooltip_fields = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:size>' , <EOL> '<STR_LIT:type>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> class Meta : <EOL> unique_together = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:size>' , '<STR_LIT:type>' , '<STR_LIT>' ) <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) <EOL> def __str__ ( self ) : <EOL> return self . name <EOL> class Component ( models . Model ) : <EOL> base_object = models . ForeignKey ( BaseObject , related_name = '<STR_LIT>' ) <EOL> model = models . ForeignKey ( <EOL> ComponentModel , <EOL> verbose_name = _ ( '<STR_LIT>' ) , <EOL> null = True , <EOL> blank = True , <EOL> default = None , <EOL> on_delete = models . SET_NULL , <EOL> ) <EOL> class Meta : <EOL> abstract = True <EOL> class GenericComponent ( Component ) : <EOL> label = models . CharField ( <EOL> verbose_name = _ ( '<STR_LIT:label>' ) , max_length = <NUM_LIT:255> , blank = True , <EOL> null = True , default = None , <EOL> ) <EOL> sn = NullableCharField ( <EOL> verbose_name = _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , unique = True , null = True , <EOL> blank = True , default = None , <EOL> ) <EOL> class Meta : <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) </s>
