ha22109
ha22109

Reputation: 8336

"View on site" button is linked to an unwanted page

Why "view on site" linked to an unwanted page? Can I disable it?

Upvotes: 1

Views: 3778

Answers (4)

zabeltech
zabeltech

Reputation: 971

the easiest and cleanest way is to set admin.site.site_url = None in your root urls.py

it works since django 1.8, here is the documentation

Upvotes: 1

ha22109
ha22109

Reputation: 8336

sudo vi /usr/local/lib/python2.6/dist-packages/django/contrib/admin/templates/admin$/change_from.html.

in this file comment out the if condition

{% if has_absolute_url %}

  • {% trans "View on site" %}
  • {% endif%}

    then view on site will never appear

    Upvotes: -4

    rennat
    rennat

    Reputation: 2559

    View on site determines the URL to link to by checking the Sites app and adding the model's get_absolute_url() method on the end of it.

    Upvotes: 4

    vikingosegundo
    vikingosegundo

    Reputation: 52237

    See the django-docs You can overwrite the admin-templates or see here, how to use it

    Upvotes: 3

    Related Questions