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
f05b03f3
Kaydet (Commit)
f05b03f3
authored
Ara 23, 2014
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed model_package test dependency on contrib.sites
üst
f233bf47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
13 deletions
+7
-13
article.py
tests/model_package/models/article.py
+4
-1
tests.py
tests/model_package/tests.py
+3
-12
No files found.
tests/model_package/models/article.py
Dosyayı görüntüle @
f05b03f3
from
django.contrib.sites.models
import
Site
from
django.db
import
models
class
Site
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
)
class
Article
(
models
.
Model
):
sites
=
models
.
ManyToManyField
(
Site
)
headline
=
models
.
CharField
(
max_length
=
100
)
...
...
tests/model_package/tests.py
Dosyayı görüntüle @
f05b03f3
from
__future__
import
unicode_literals
from
django.contrib.sites.models
import
Site
from
django.db
import
models
,
connection
from
django.db.backends.utils
import
truncate_name
from
django.test
import
TestCase
from
.models.publication
import
Publication
from
.models.article
import
Article
from
.models.article
import
Article
,
Site
class
Advertisement
(
models
.
Model
):
...
...
@@ -16,13 +15,6 @@ class Advertisement(models.Model):
class
ModelPackageTests
(
TestCase
):
@classmethod
def
setUpClass
(
cls
):
super
(
ModelPackageTests
,
cls
)
.
setUpClass
()
# This cleanup is necessary because contrib.sites cache
# makes tests interfere with each other, see #11505
Site
.
objects
.
clear_cache
()
def
test_m2m_tables_in_subpackage_models
(
self
):
"""
Regression for #12168: models split into subpackages still get M2M
...
...
@@ -30,12 +22,11 @@ class ModelPackageTests(TestCase):
"""
p
=
Publication
.
objects
.
create
(
title
=
"FooBar"
)
current_site
=
Site
.
objects
.
get_current
()
self
.
assertEqual
(
current_site
.
domain
,
"example.com"
)
site
=
Site
.
objects
.
create
(
name
=
"example.com"
)
a
=
Article
.
objects
.
create
(
headline
=
"a foo headline"
)
a
.
publications
.
add
(
p
)
a
.
sites
.
add
(
current_
site
)
a
.
sites
.
add
(
site
)
a
=
Article
.
objects
.
get
(
id
=
a
.
pk
)
self
.
assertEqual
(
a
.
id
,
a
.
pk
)
...
...
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