<s> import os <EOL> from django . db import models <EOL> from core . models import PlCoreBase <EOL> from core . models import Slice <EOL> from core . models . plcorebase import StrippedCharField <EOL> class SliceTag ( PlCoreBase ) : <EOL> slice = models . ForeignKey ( Slice , related_name = '<STR_LIT>' ) <EOL> NAME_CHOICES = ( ( '<STR_LIT>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> name = StrippedCharField ( help_text = "<STR_LIT>" , max_length = <NUM_LIT:30> , choices = NAME_CHOICES ) <EOL> value = StrippedCharField ( help_text = "<STR_LIT>" , max_length = <NUM_LIT> ) <EOL> def can_update ( self , user ) : <EOL> return user . can_update_slice ( self . slice ) <EOL> @ staticmethod <EOL> def select_by_user ( user ) : <EOL> if user . is_admin : <EOL> qs = SliceTag . objects . all ( ) <EOL> else : <EOL> slices = Slice . select_by_user ( user ) <EOL> qs = SliceTag . objects . filter ( slice__in = slices ) <EOL> return qs </s>
