Reputation: 321
I have django 1.9.12 installed. Where is now get_absolute_url from django.db.models.base ? How can i find it? I tried to find it in django.db.models.base, but can't find it.
Upvotes: 0
Views: 171
Reputation: 369484
It's not a method that is pre-defined.
You need to implement it in your model class.
According to the documentation:
Define a
get_absolute_url()
method to tell Django how to calculate the canonical URL for an object. To callers, this method should appear to return a string that can be used to refer to the object over HTTP.For example:
def get_absolute_url(self): return "/people/%i/" % self.id
Upvotes: 2