mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
fix generateschema command
This commit is contained in:
parent
36f423870b
commit
34820a1233
|
@ -28,7 +28,7 @@ class Command(BaseCommand):
|
|||
parser.add_argument('--urlconf', dest="urlconf", default=None, type=str)
|
||||
parser.add_argument('--generator_class', dest="generator_class", default=None, type=str)
|
||||
parser.add_argument('--file', dest="file", default=None, type=str)
|
||||
parser.add_argument('--tag_objects', dest="tag_objects", default=None, type=dict)
|
||||
parser.add_argument('--tag_objects', dest="tag_objects", default=None, type=str)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if options['generator_class']:
|
||||
|
@ -36,13 +36,17 @@ class Command(BaseCommand):
|
|||
else:
|
||||
generator_class = self.get_generator_class()
|
||||
|
||||
kwargs = {}
|
||||
if issubclass(generator_class, SchemaGenerator):
|
||||
tag_objects = ast.literal_eval(options['tag_objects']) if options['tag_objects'] else None
|
||||
kwargs['tag_objects'] = tag_objects
|
||||
|
||||
generator = generator_class(
|
||||
url=options['url'],
|
||||
title=options['title'],
|
||||
description=options['description'],
|
||||
urlconf=options['urlconf'],
|
||||
tag_objects=tag_objects,
|
||||
**kwargs,
|
||||
)
|
||||
schema = generator.get_schema(request=None, public=True)
|
||||
renderer = self.get_renderer(options['format'])
|
||||
|
|
Loading…
Reference in New Issue
Block a user