I added a get_absolute_url
function to one of my models.
def get_absolute_url(self): return '/foo/bar'
The admin site picks it up and adds a "view on site" link to the detail page for that object (when I put a real URL there instead of "/foo/bar").
The problem is instead of going to http://localhost:8000/foo/bar
, it goes to http://example.com/foo/bar
.
What am I doing wrong?
One of the most powerful parts of Django is the automatic admin interface. It reads metadata from your models to provide a quick, model-centric interface where trusted users can manage content on your site. The admin's recommended use is limited to an organization's internal management tool.
In this article, we will discuss how to enhance Django-admin Interface. Let us create an app called state which has one model with the same name(state). When we register app to admin.py it shows like. Now lets' customize django admin according to available options.
You have to change default site domain value.
The funniest thing is that "example.com" appears in an obvious place. Yet, I was looking for in in an hour or so.
Just use your admin interface -> Sites -> ... there it is :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With