16
16
from __future__ import unicode_literals
17
17
18
18
import itertools
19
- import warnings
20
19
from collections import OrderedDict , namedtuple
21
20
22
21
from django .conf .urls import url
@@ -330,41 +329,12 @@ class DefaultRouter(SimpleRouter):
330
329
SchemaGenerator = SchemaGenerator
331
330
332
331
def __init__ (self , * args , ** kwargs ):
333
- if 'schema_title' in kwargs :
334
- warnings .warn (
335
- "Including a schema directly via a router is now deprecated. "
336
- "Use `get_schema_view()` instead." ,
337
- DeprecationWarning , stacklevel = 2
338
- )
339
- if 'schema_renderers' in kwargs :
340
- assert 'schema_title' in kwargs , 'Missing "schema_title" argument.'
341
- if 'schema_url' in kwargs :
342
- assert 'schema_title' in kwargs , 'Missing "schema_title" argument.'
343
- self .schema_title = kwargs .pop ('schema_title' , None )
344
- self .schema_url = kwargs .pop ('schema_url' , None )
345
- self .schema_renderers = kwargs .pop ('schema_renderers' , self .default_schema_renderers )
346
-
347
332
if 'root_renderers' in kwargs :
348
333
self .root_renderers = kwargs .pop ('root_renderers' )
349
334
else :
350
335
self .root_renderers = list (api_settings .DEFAULT_RENDERER_CLASSES )
351
336
super (DefaultRouter , self ).__init__ (* args , ** kwargs )
352
337
353
- def get_schema_root_view (self , api_urls = None ):
354
- """
355
- Return a schema root view.
356
- """
357
- schema_generator = self .SchemaGenerator (
358
- title = self .schema_title ,
359
- url = self .schema_url ,
360
- patterns = api_urls
361
- )
362
-
363
- return self .APISchemaView .as_view (
364
- renderer_classes = self .schema_renderers ,
365
- schema_generator = schema_generator ,
366
- )
367
-
368
338
def get_api_root_view (self , api_urls = None ):
369
339
"""
370
340
Return a basic root view.
@@ -384,10 +354,7 @@ def get_urls(self):
384
354
urls = super (DefaultRouter , self ).get_urls ()
385
355
386
356
if self .include_root_view :
387
- if self .schema_title :
388
- view = self .get_schema_root_view (api_urls = urls )
389
- else :
390
- view = self .get_api_root_view (api_urls = urls )
357
+ view = self .get_api_root_view (api_urls = urls )
391
358
root_url = url (r'^$' , view , name = self .root_view_name )
392
359
urls .append (root_url )
393
360
0 commit comments