Add function to generate an url to use it in the view.

- updated version
- debugged
- added function
- added test