0
def findUser(params):
    user=Users.objects.filter(params).first()
    if(user):
        return user
    return False

findUser(name='a',code=123)

How to do this ?

In what way to pass parameters to another function?

PiHPY
  • 1
  • 2
  • [Basic Python Tutorial](https://www.w3schools.com/python/python_functions.asp) – BeRT2me Jun 05 '22 at 05:53
  • What exactly are you trying to do? Are you asking how you pass arguments to a function and access them, as user @BeRT2me seems to suggest? Or do you have a less basic problem? If so, please add some details on what you're trying to achieve and how that's not working. – Grismar Jun 05 '22 at 05:56
  • if you want ot use `def findUser(params):` then it expects only single value and you should send values as single object - ie.as dictionary `findUser( {"name": "a', "code": 123} )`. And it may need to use `**` to unpack this dictionary `filter(**params)` – furas Jun 05 '22 at 09:59
  • if you want to run `findUser(name='a',code=123)` then you should define `def findUser(name, code):` and use variables in `fitler(name=name, code=code)`. – furas Jun 05 '22 at 10:03

0 Answers0