Advnace function

completed advance function now need to put into models.py