Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. def check_empty(data, model, id):
  2.     res = []
  3.     if not data or (data[0].id == id and len(data) == 1):
  4.         res = model.objects.values_list('id', flat=True)
  5.     else:
  6.         for c in data:
  7.             res += c.get_self_and_childrens_ids()
  8.     #res = list(set(res))
  9.     return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement