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
a24cf217
Kaydet (Commit)
a24cf217
authored
Eki 05, 2014
tarafından
Emmanuelle Delescolle
Kaydeden (comit)
Tim Graham
Eki 06, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #23604 -- Allowed related m2m fields to be references in the admin.
Thanks Simon Charette for review.
üst
e501d4c5
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
5 deletions
+37
-5
options.py
django/contrib/admin/options.py
+5
-0
1.4.16.txt
docs/releases/1.4.16.txt
+5
-2
1.5.11.txt
docs/releases/1.5.11.txt
+4
-1
1.6.8.txt
docs/releases/1.6.8.txt
+4
-1
1.7.1.txt
docs/releases/1.7.1.txt
+3
-0
admin.py
tests/admin_views/admin.py
+2
-1
models.py
tests/admin_views/models.py
+10
-0
tests.py
tests/admin_views/tests.py
+4
-0
No files found.
django/contrib/admin/options.py
Dosyayı görüntüle @
a24cf217
...
...
@@ -451,6 +451,11 @@ class BaseModelAdmin(six.with_metaclass(forms.MediaDefiningClass)):
except
FieldDoesNotExist
:
return
False
# Check whether this model is the origin of a M2M relationship
# in which case to_field has to be the pk on this model.
if
opts
.
many_to_many
and
field
.
primary_key
:
return
True
# Make sure at least one of the models registered for this site
# references this field through a FK or a M2M relationship.
registered_models
=
set
()
...
...
docs/releases/1.4.16.txt
Dosyayı görüntüle @
a24cf217
...
...
@@ -4,12 +4,15 @@ Django 1.4.16 release notes
*Under development*
Django 1.4.16 fixes a
regression in the 1.4.14 security release and a bug
preventing the use of some GEOS versions with GeoDjango.
Django 1.4.16 fixes a
couple regressions in the 1.4.14 security release and a
bug
preventing the use of some GEOS versions with GeoDjango.
Bugfixes
========
* Allowed related many-to-many fields to be referenced in the admin
(`#23604 <http://code.djangoproject.com/ticket/23604>`_).
* Allowed inline and hidden references to admin fields
(`#23431 <http://code.djangoproject.com/ticket/23431>`_).
...
...
docs/releases/1.5.11.txt
Dosyayı görüntüle @
a24cf217
...
...
@@ -4,10 +4,13 @@ Django 1.5.11 release notes
*Under development*
Django 1.5.11 fixes a
regression
in the 1.5.9 security release.
Django 1.5.11 fixes a
couple regressions
in the 1.5.9 security release.
Bugfixes
========
* Allowed related many-to-many fields to be referenced in the admin
(`#23604 <http://code.djangoproject.com/ticket/23604>`_).
* Allowed inline and hidden references to admin fields
(`#23431 <http://code.djangoproject.com/ticket/23431>`_).
docs/releases/1.6.8.txt
Dosyayı görüntüle @
a24cf217
...
...
@@ -4,9 +4,12 @@ Django 1.6.8 release notes
*Under development*
Django 1.6.8 fixes a
regression
in the 1.6.6 security release.
Django 1.6.8 fixes a
couple regressions
in the 1.6.6 security release.
Bugfixes
========
* Allowed related many-to-many fields to be referenced in the admin
(:ticket:`23604`).
* Allowed inline and hidden references to admin fields (:ticket:`23431`).
docs/releases/1.7.1.txt
Dosyayı görüntüle @
a24cf217
...
...
@@ -9,6 +9,9 @@ Django 1.7.1 fixes several bugs in 1.7.
Bugfixes
========
* Allowed related many-to-many fields to be referenced in the admin
(:ticket:`23604`).
* Added a more helpful error message if you try to migrate an app without first
creating the ``contenttypes`` table (:ticket:`22411`).
...
...
tests/admin_views/admin.py
Dosyayı görüntüle @
a24cf217
...
...
@@ -37,7 +37,7 @@ from .models import (Article, Chapter, Child, Parent, Picture, Widget,
State
,
City
,
Restaurant
,
Worker
,
ParentWithDependentChildren
,
DependentChild
,
StumpJoke
,
FieldOverridePost
,
FunkyTag
,
ReferencedByParent
,
ChildOfReferer
,
M2MReference
,
ReferencedByInline
,
InlineReference
,
InlineReferer
)
InlineReference
,
InlineReferer
,
Ingredient
)
def
callable_year
(
dt_value
):
...
...
@@ -940,6 +940,7 @@ site.register(EmptyModelHidden, EmptyModelHiddenAdmin)
site
.
register
(
EmptyModelVisible
,
EmptyModelVisibleAdmin
)
site
.
register
(
EmptyModelMixin
,
EmptyModelMixinAdmin
)
site
.
register
(
StumpJoke
)
site
.
register
(
Ingredient
)
# Register core models we need in our tests
from
django.contrib.auth.models
import
User
,
Group
...
...
tests/admin_views/models.py
Dosyayı görüntüle @
a24cf217
...
...
@@ -852,3 +852,13 @@ class InlineReference(models.Model):
class
InlineReferer
(
models
.
Model
):
refs
=
models
.
ManyToManyField
(
InlineReference
)
# Models for #23604
class
Recipe
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
20
)
class
Ingredient
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
20
)
recipes
=
models
.
ManyToManyField
(
'Recipe'
,
related_name
=
'ingredients'
)
tests/admin_views/tests.py
Dosyayı görüntüle @
a24cf217
...
...
@@ -620,6 +620,10 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
response
=
self
.
client
.
get
(
"/test_admin/admin/admin_views/m2mreference/"
,
{
TO_FIELD_VAR
:
'id'
})
self
.
assertEqual
(
response
.
status_code
,
200
)
# #23604 - Specifying the pk of this model should be allowed when this model defines a m2m relationship
response
=
self
.
client
.
get
(
"/test_admin/admin/admin_views/ingredient/"
,
{
TO_FIELD_VAR
:
'id'
})
self
.
assertEqual
(
response
.
status_code
,
200
)
# #23329 - Specifying a field that is not refered by any other model directly registered
# to this admin site but registered through inheritance should be allowed.
response
=
self
.
client
.
get
(
"/test_admin/admin/admin_views/referencedbyparent/"
,
{
TO_FIELD_VAR
:
'id'
})
...
...
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