Advertisement
go6odn28

update_function

Jul 1st, 2024 (edited)
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. def update_dungeon_fields(search_field, criteria, **update_fields):  # Help function for update
  2.     filter_kwargs = {search_field: criteria}
  3.     Dungeon.objects.filter(**filter_kwargs).update(**update_fields)
  4.  
  5.  
  6. def update_dungeon_names():
  7.     update_dungeon_fields("difficulty", "Easy", name="The Erased Thombs")
  8.     update_dungeon_fields("difficulty", "Medium", name="The Coral Labyrinth")
  9.     update_dungeon_fields("difficulty", "Hard", name="The Lost Haunt")
  10.  
  11.  
  12. def update_dungeon_recommended_levels():
  13.     update_dungeon_fields("difficulty", "Easy", recommended_level=25)
  14.     update_dungeon_fields("difficulty", "Medium", recommended_level=50)
  15.     update_dungeon_fields("difficulty", "Hard", recommended_level=75)
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement