global name 'reverse' is not defined
reverse
isn't a builtin function in python. Presumably, it's a function in some web framework for doing reverse-routing (getting a url path from a name). The notify_url
has to be a url in your application that Paypal will send notices to.
You need to import the function reverse
:
For Django 2.0 and up:
from django.urls import reverse
For older Django:
from django.core.urlresolvers import reverse
It's specific to django, but it looks like you're trying to build a URL anyway, so it's probably what you want.
in Django2.0 :
from django.urls import reverse
--Use this code in models.py
......
from django.urls import reverse
def get_absolute_url(self):
return reverse('url-name', kwargs={'pk':self.pk})