Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
a81af7f4
Kaydet (Commit)
a81af7f4
authored
Agu 26, 2014
tarafından
areski
Kaydeden (comit)
Tim Graham
Agu 27, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #13749 -- Added link from admin site to front-end site.
Thanks romankrv for the suggestion.
üst
6aae07fe
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
0 deletions
+28
-0
sites.py
django/contrib/admin/sites.py
+4
-0
base.html
django/contrib/admin/templates/admin/base.html
+3
-0
index.txt
docs/ref/contrib/admin/index.txt
+7
-0
1.8.txt
docs/releases/1.8.txt
+4
-0
admin.py
tests/admin_views/admin.py
+1
-0
tests.py
tests/admin_views/tests.py
+9
-0
No files found.
django/contrib/admin/sites.py
Dosyayı görüntüle @
a81af7f4
...
...
@@ -41,6 +41,9 @@ class AdminSite(object):
# Text to put at the top of the admin index page.
index_title
=
ugettext_lazy
(
'Site administration'
)
# URL for the "View site" link at the top of each admin page.
site_url
=
'/'
login_form
=
None
index_template
=
None
app_index_template
=
None
...
...
@@ -272,6 +275,7 @@ class AdminSite(object):
return
{
'site_title'
:
self
.
site_title
,
'site_header'
:
self
.
site_header
,
'site_url'
:
self
.
site_url
,
}
def
password_change
(
self
,
request
):
...
...
django/contrib/admin/templates/admin/base.html
Dosyayı görüntüle @
a81af7f4
...
...
@@ -31,6 +31,9 @@
<strong>
{% firstof user.get_short_name user.get_username %}
</strong>
.
{% endblock %}
{% block userlinks %}
{% if site_url %}
<a
href=
"{{ site_url }}"
>
{% trans 'View site' %}
</a>
/
{% endif %}
{% url 'django-admindocs-docroot' as docsroot %}
{% if docsroot %}
<a
href=
"{{ docsroot }}"
>
{% trans 'Documentation' %}
</a>
/
...
...
docs/ref/contrib/admin/index.txt
Dosyayı görüntüle @
a81af7f4
...
...
@@ -2445,6 +2445,13 @@ Templates can override or extend base admin templates as described in
The text to put at the end of each admin page's ``<title>`` (a string). By
default, this is "Django site admin".
.. attribute:: AdminSite.site_url
.. versionadded:: 1.8
The URL for the "View site" link at the top of each admin page. By default,
``site_url`` is ``/``. Set it to ``None`` to remove the link.
.. attribute:: AdminSite.index_title
.. versionadded:: 1.7
...
...
docs/releases/1.8.txt
Dosyayı görüntüle @
a81af7f4
...
...
@@ -50,6 +50,10 @@ Minor features
* The jQuery library embedded in the admin has been upgraded to version 1.11.1.
* You can now specify :attr:`AdminSite.site_url
<django.contrib.admin.AdminSite.site_url>` in order to display a link to the
front-end site.
:mod:`django.contrib.auth`
^^^^^^^^^^^^^^^^^^^^^^^^^^
...
...
tests/admin_views/admin.py
Dosyayı görüntüle @
a81af7f4
...
...
@@ -832,6 +832,7 @@ class FunkyTagAdmin(admin.ModelAdmin):
site
=
admin
.
AdminSite
(
name
=
"admin"
)
site
.
site_url
=
'/my-site-url/'
site
.
register
(
Article
,
ArticleAdmin
)
site
.
register
(
CustomArticle
,
CustomArticleAdmin
)
site
.
register
(
Section
,
save_as
=
True
,
inlines
=
[
ArticleInline
])
...
...
tests/admin_views/tests.py
Dosyayı görüntüle @
a81af7f4
...
...
@@ -744,6 +744,15 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
color2_delete_log
=
LogEntry
.
objects
.
all
()[
0
]
self
.
assertEqual
(
color2_content_type
,
color2_delete_log
.
content_type
)
def
test_adminsite_display_site_url
(
self
):
"""
#13749 - Admin should display link to front-end site 'View site'
"""
url
=
reverse
(
'admin:index'
)
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
context
[
'site_url'
],
'/my-site-url/'
)
self
.
assertContains
(
response
,
'<a href="/my-site-url/">View site</a>'
)
@override_settings
(
TEMPLATE_DIRS
=
ADMIN_VIEW_TEMPLATES_DIR
)
class
AdminCustomTemplateTests
(
AdminViewBasicTestCase
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment