Fix error in auto_delete_photo_on_change
This commit is contained in:
		
							parent
							
								
									27947907d5
								
							
						
					
					
						commit
						0a98e4a778
					
				
					 1 changed files with 2 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -96,7 +96,5 @@ def auto_delete_photo_on_change(sender, instance, **kwargs):
 | 
			
		|||
    except Recette.DoesNotExist:
 | 
			
		||||
        return False
 | 
			
		||||
 | 
			
		||||
    new_file = instance.photo
 | 
			
		||||
    if not old_file == new_file:
 | 
			
		||||
        if os.path.isfile(old_file.path):
 | 
			
		||||
            os.remove(old_file.path)
 | 
			
		||||
    if old_file and old_file != instance.photo and os.path.isfile(old_file.path):
 | 
			
		||||
        os.remove(old_file.path)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue