<s> from django . conf . urls import url , patterns <EOL> from . views import ItemView , ListView <EOL> class API ( object ) : <EOL> def __init__ ( self ) : <EOL> self . resources = [ ] <EOL> def register ( self , resource ) : <EOL> self . resources . append ( resource ( ) ) <EOL> def get_urls ( self ) : <EOL> urls = [ ] <EOL> for resource in self . resources : <EOL> urls . extend ( [ url ( r"<STR_LIT>" . format ( resource . name ) , <EOL> ListView . as_view ( resource = resource ) , <EOL> name = "<STR_LIT>" . format ( resource . name ) ) , <EOL> url ( r"<STR_LIT>" . format ( resource . name ) , <EOL> ItemView . as_view ( resource = resource ) , <EOL> name = "<STR_LIT>" . format ( resource . name ) ) ] ) <EOL> return patterns ( '<STR_LIT>' , * urls ) </s>
