Code

Ticket #16243: 16243.model_forms-pil-tests.diff

File 16243.model_forms-pil-tests.diff, 1.6 KB (added by julien, 3 years ago)
Line 
1diff --git a/tests/modeltests/model_forms/tests.py b/tests/modeltests/model_forms/tests.py
2index b67c160..0831035 100644
3--- a/tests/modeltests/model_forms/tests.py
4+++ b/tests/modeltests/model_forms/tests.py
5@@ -14,11 +14,19 @@ from django.utils.unittest import skipUnless
6 from modeltests.model_forms.models import (Article, ArticleStatus,
7     BetterWriter, BigInt, Book, Category, CommaSeparatedInteger,
8     CustomFieldForExclusionModel, DerivedBook, DerivedPost, ExplicitPK,
9-    FlexibleDatePost, ImageFile, ImprovedArticle,
10-    ImprovedArticleWithParentLink, Inventory, OptionalImageFile, PhoneNumber,
11-    Post, Price, Product, TextFile, Writer, WriterProfile,
12-    test_images)
13+    FlexibleDatePost, ImprovedArticle, ImprovedArticleWithParentLink,
14+    Inventory, PhoneNumber, Post, Price, Product, TextFile, Writer,
15+    WriterProfile, test_images)
16 
17+if test_images:
18+    from modeltests.model_forms.models import ImageFile, OptionalImageFile
19+    class ImageFileForm(forms.ModelForm):
20+        class Meta:
21+            model = ImageFile
22+
23+    class OptionalImageFileForm(forms.ModelForm):
24+        class Meta:
25+            model = OptionalImageFile
26 
27 class ProductForm(forms.ModelForm):
28     class Meta:
29@@ -149,14 +157,6 @@ class BigIntForm(forms.ModelForm):
30     class Meta:
31         model = BigInt
32 
33-class ImageFileForm(forms.ModelForm):
34-    class Meta:
35-        model = ImageFile
36-
37-class OptionalImageFileForm(forms.ModelForm):
38-    class Meta:
39-        model = OptionalImageFile
40-
41 class ModelFormWithMedia(forms.ModelForm):
42     class Media:
43         js = ('/some/form/javascript',)