<s> import json <EOL> from django . db . models . query import QuerySet <EOL> from django . core . management import call_command <EOL> from django . core . management . base import LabelCommand <EOL> from django . core import serializers <EOL> from cbv import models <EOL> class Command ( LabelCommand ) : <EOL> """<STR_LIT>""" <EOL> def handle_label ( self , label , ** options ) : <EOL> filtered_models = ( <EOL> ( models . ProjectVersion , '<STR_LIT>' ) , <EOL> ( models . Module , '<STR_LIT>' ) , <EOL> ( models . ModuleAttribute , '<STR_LIT>' ) , <EOL> ( models . Function , '<STR_LIT>' ) , <EOL> ( models . Klass , '<STR_LIT>' ) , <EOL> ( models . KlassAttribute , '<STR_LIT>' ) , <EOL> ( models . Method , '<STR_LIT>' ) , <EOL> ( models . Inheritance , '<STR_LIT>' ) , <EOL> ) <EOL> objects = [ ] <EOL> for model , version_arg in filtered_models : <EOL> filter_kwargs = { version_arg : label } <EOL> result = model . objects . filter ( ** filter_kwargs ) <EOL> objects = objects + list ( result ) <EOL> for obj in objects : <EOL> obj . pk = None <EOL> dump = serializers . serialize ( '<STR_LIT>' , objects , indent = <NUM_LIT:1> , use_natural_keys = True ) <EOL> self . stdout . write ( dump ) </s>
