oauth2_client/management/commands/oauth2_app_maker.py
def _update(self, application_data):
        """
        Updates an existing application, if model validation successful.

        Args:
            application_data (dict): key-values to update the App with

        Returns:
            None:

        Raises:
            ValidationError:  1) when app does not exist; 2) when multiple apps exist with same name;
            3) when data constraints defined on the model violated
        """
        app_name = application_data.pop('name')
        app_model = self.app_model()
        application_data['updated'] = timezone.now()
        try:
            app = app_model.objects.get(name=app_name)
            changed = False
            for key, target_val in application_data.items():
                current_val = getattr(app, key)
                if current_val != target_val:
                    setattr(app, key, target_val)
                    changed = True
            if changed:
                app.full_clean(validate_unique=False)  # trigger validation
                app.save()
            self.logger.info('Application %s successfully updated.', app_name)
        except (app_model.MultipleObjectsReturned, app_model.DoesNotExist) as e:
            msg = (
                'Exactly one application with name={} must exist to be updated. Original error: {}'
                .format(app_name, e)
            )
            raise ValidationError({'name': msg})

        Updates an existing application, if model validation successful.

        Args:
            application_data (dict): key-values to update the App with

        Returns:
            None:

        Raises:
            ValidationError:  1) when app does not exist; 2) when multiple apps exist with same name;
            3) when data constraints defined on the model violated
        
Updates an existing application, if model validation successful.
Args:
application_data (dict): key-values to update the App with



1) when app does not exist; 2) when multiple apps exist with same name;
3) when data constraints defined on the model violated
Updates an existing application if model validation successful . Args : application_data ( dict ) : key - values to update the App with 1 ) when app does not exist ; 2 ) when multiple apps exist with same name ; 3 ) when data constraints defined on the model violated
def _update(self, application_data):
        app_name = application_data.pop('name')
        app_model = self.app_model()
        application_data['updated'] = timezone.now()
        try:
            app = app_model.objects.get(name=app_name)
            changed = False
            for key, target_val in application_data.items():
                current_val = getattr(app, key)
                if current_val != target_val:
                    setattr(app, key, target_val)
                    changed = True
            if changed:
                app.full_clean(validate_unique=False)  
                app.save()
            self.logger.info('Application %s successfully updated.', app_name)
        except (app_model.MultipleObjectsReturned, app_model.DoesNotExist) as e:
            msg = (
                'Exactly one application with name={} must exist to be updated. Original error: {}'
                .format(app_name, e)
            )
            raise ValidationError({'name': msg})
def _update ( self , application_data ) : app_name = application_data . pop ( 'name' ) app_model = self . app_model ( ) application_data [ 'updated' ] = timezone . now ( ) try : app = app_model . objects . get ( name = app_name ) changed = False for key , target_val in application_data . items ( ) : current_val = getattr ( app , key ) if current_val != target_val : setattr ( app , key , target_val ) changed = True if changed : app . full_clean ( validate_unique = False ) app . save ( ) self . logger . info ( 'Application %s successfully updated.' , app_name ) except ( app_model . MultipleObjectsReturned , app_model . DoesNotExist ) as e : msg = ( 'Exactly one application with name={} must exist to be updated. Original error: {}' . format ( app_name , e ) ) raise ValidationError ( { 'name' : msg } )
Updates an existing application, if model validation successful.
Updates an existing application if model validation successful .
"""
        Updates an existing application, if model validation successful.

        Args:
            application_data (dict): key-values to update the App with

        Returns:
            None:

        Raises:
            ValidationError:  1) when app does not exist; 2) when multiple apps exist with same name;
            3) when data constraints defined on the model violated
        """ # trigger validation
self
application_data