def handle(self, *args, **options): # Loop over the namespaces for namespace in args: # Clear the index of this type of resource ix = ResourceBrowser.clear_index(namespace) if ix is None: raise CommandError('Resource "%s" does not exist' % namespace) # Get the model of this type of resource model = ResourceBrowser.get_resource_model(namespace) # Add model fields for each resource for resource in model.objects.all(): ResourceBrowser.add_resource(namespace, resource=resource) self.stdout.write('The index of "%s" resource was updated successfully.\n' % namespace)
def handle(self, *args, **options): # Loop over the namespaces for namespace in args: # Clear the index of this type of resource ix = ResourceBrowser.clear_index(namespace) if ix is None: raise CommandError('Resource "%s" does not exist' % namespace) # Get the model of this type of resource model = ResourceBrowser.get_resource_model(namespace) # Add model fields for each resource for resource in model.objects.all(): ResourceBrowser.add_resource(namespace, resource=resource) self.stdout.write( 'The index of "%s" resource was updated successfully.\n' % namespace)