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
c832885a
Kaydet (Commit)
c832885a
authored
Agu 18, 2018
tarafından
mackong
Kaydeden (comit)
Tim Graham
Agu 18, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29426 -- Made UUID inputs in the admin match the width of a UUID.
üst
b042ab89
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
1 deletion
+21
-1
options.py
django/contrib/admin/options.py
+1
-0
forms.css
django/contrib/admin/static/admin/css/forms.css
+1
-1
widgets.py
django/contrib/admin/widgets.py
+5
-0
tests.py
tests/admin_widgets/tests.py
+14
-0
No files found.
django/contrib/admin/options.py
Dosyayı görüntüle @
c832885a
...
...
@@ -92,6 +92,7 @@ FORMFIELD_FOR_DBFIELD_DEFAULTS = {
models
.
ImageField
:
{
'widget'
:
widgets
.
AdminFileWidget
},
models
.
FileField
:
{
'widget'
:
widgets
.
AdminFileWidget
},
models
.
EmailField
:
{
'widget'
:
widgets
.
AdminEmailInputWidget
},
models
.
UUIDField
:
{
'widget'
:
widgets
.
AdminUUIDInputWidget
},
}
csrf_protect_m
=
method_decorator
(
csrf_protect
)
...
...
django/contrib/admin/static/admin/css/forms.css
Dosyayı görüntüle @
c832885a
...
...
@@ -353,7 +353,7 @@ body.popup .submit-row {
width
:
2.2em
;
}
.vTextField
{
.vTextField
,
.vUUIDField
{
width
:
20em
;
}
...
...
django/contrib/admin/widgets.py
Dosyayı görüntüle @
c832885a
...
...
@@ -351,6 +351,11 @@ class AdminBigIntegerFieldWidget(AdminIntegerFieldWidget):
class_name
=
'vBigIntegerField'
class
AdminUUIDInputWidget
(
forms
.
TextInput
):
def
__init__
(
self
,
attrs
=
None
):
super
()
.
__init__
(
attrs
=
{
'class'
:
'vUUIDField'
,
**
(
attrs
or
{})})
# Mapping of lower case language codes [returned by Django's get_language()]
# to language codes supported by select2.
# See django/contrib/admin/static/admin/js/vendor/select2/i18n/*
...
...
tests/admin_widgets/tests.py
Dosyayı görüntüle @
c832885a
...
...
@@ -408,6 +408,20 @@ class AdminURLWidgetTest(SimpleTestCase):
)
class
AdminUUIDWidgetTests
(
SimpleTestCase
):
def
test_attrs
(
self
):
w
=
widgets
.
AdminUUIDInputWidget
()
self
.
assertHTMLEqual
(
w
.
render
(
'test'
,
'550e8400-e29b-41d4-a716-446655440000'
),
'<input value="550e8400-e29b-41d4-a716-446655440000" type="text" class="vUUIDField" name="test">'
,
)
w
=
widgets
.
AdminUUIDInputWidget
(
attrs
=
{
'class'
:
'myUUIDInput'
})
self
.
assertHTMLEqual
(
w
.
render
(
'test'
,
'550e8400-e29b-41d4-a716-446655440000'
),
'<input value="550e8400-e29b-41d4-a716-446655440000" type="text" class="myUUIDInput" name="test">'
,
)
@override_settings
(
ROOT_URLCONF
=
'admin_widgets.urls'
)
class
AdminFileWidgetTests
(
TestDataMixin
,
TestCase
):
...
...
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