diff --git a/zerver/management/commands/create_default_stream_groups.py b/zerver/management/commands/create_default_stream_groups.py index 397a85f475..7cc7784757 100644 --- a/zerver/management/commands/create_default_stream_groups.py +++ b/zerver/management/commands/create_default_stream_groups.py @@ -17,6 +17,22 @@ Create default stream groups which the users can choose during sign up. # type: (ArgumentParser) -> None self.add_realm_args(parser, True) + parser.add_argument( + '-n', '--name', + dest='name', + type=str, + required=True, + help='Name of the group you want to create.' + ) + + parser.add_argument( + '-d', '--description', + dest='description', + type=str, + required=True, + help='Description of the group.' + ) + parser.add_argument( '-s', '--streams', dest='streams', @@ -24,14 +40,6 @@ Create default stream groups which the users can choose during sign up. required=True, help='A comma-separated list of stream names.') - parser.add_argument( - '-d', '--default-stream-group', - dest='default_stream_group', - type=str, - required=True, - help='Name of the group you want to create.' - ) - def handle(self, *args, **options): # type: (*Any, **Any) -> None realm = self.get_realm(options) @@ -45,15 +53,17 @@ Create default stream groups which the users can choose during sign up. try: default_stream_group = DefaultStreamGroup.objects.get( - name=options["default_stream_group"], realm=realm) + name=options["name"], realm=realm, description=options["description"]) except DefaultStreamGroup.DoesNotExist: default_stream_group = DefaultStreamGroup.objects.create( - name=options["default_stream_group"], realm=realm) + name=options["name"], realm=realm, description=options["description"]) default_stream_group.streams = streams default_stream_group.save() default_stream_groups = DefaultStreamGroup.objects.all() for default_stream_group in default_stream_groups: print(default_stream_group.name) + print(default_stream_group.description) for stream in default_stream_group.streams.all(): print(stream.name) + print("")