@@ -21,7 +21,20 @@ def setUp(self):
21
21
# Mock Django's get_template so that it doesn't load a real file;
22
22
# instead just return a template that allows us to verify the context
23
23
model_nodes .get_template = Mock (
24
- return_value = Template ('{{ title|default_if_none:instance|safe }}:{{ model|safe }},{% for name, label, value, is_list in fields %}{{ name|safe }},{{ label|safe }},{% if not is_list %}{{ value|safe }}{% else %}[{% for item in value.all %}{{ item|safe }},{% endfor %}]{% endif %},{% endfor %}' ))
24
+ return_value = Template (('{{ title|default_if_none:instance|safe }}:{{ model|safe }},'
25
+ '{% for name, label, value, is_list, is_link in fields %}'
26
+ '{{ name|safe }},'
27
+ '{{ label|safe }},'
28
+ '{% if not is_list %}'
29
+ '{% if is_link %}'
30
+ '@{{ value }}'
31
+ '{% else %}'
32
+ '{{ value|safe }}'
33
+ '{% endif %}'
34
+ '{% else %}'
35
+ '[{% for item in value.all %}{{ item|safe }},{% endfor %}]'
36
+ '{% endif %},'
37
+ '{% endfor %}' )))
25
38
26
39
27
40
def test_model_format (self ):
@@ -34,6 +47,7 @@ def test_model_format(self):
34
47
"width,width,15,"
35
48
"manufacture_date,manufacture date,2011-06-10 11:12:33,"
36
49
"color,color,red,"
50
+ "address,address,@ppr://1235/,"
37
51
"distributed_by,distributed by,Walmart,"
38
52
"knuckles,knuckles,[Knuckle of hardness 2.35,Knuckle of hardness 1.10,],"
39
53
"jambs,jambs,[],"
@@ -59,6 +73,7 @@ def test_filter_is_registered(self):
59
73
"width,width,15,"
60
74
"manufacture_date,manufacture date,2011-06-10 11:12:33,"
61
75
"color,color,red,"
76
+ "address,address,@ppr://1235/,"
62
77
"distributed_by,distributed by,Walmart,"
63
78
"knuckles,knuckles,[Knuckle of hardness 2.35,Knuckle of hardness 1.10,],"
64
79
"jambs,jambs,[],"
@@ -84,6 +99,7 @@ def test_title_is_used(self):
84
99
"width,width,15,"
85
100
"manufacture_date,manufacture date,2011-06-10 11:12:33,"
86
101
"color,color,red,"
102
+ "address,address,@ppr://1235/,"
87
103
"distributed_by,distributed by,Walmart,"
88
104
"knuckles,knuckles,[Knuckle of hardness 2.35,Knuckle of hardness 1.10,],"
89
105
"jambs,jambs,[],"
@@ -129,6 +145,7 @@ def test_model_format(self):
129
145
"width,width,15,"
130
146
"manufacture_date,manufacture date,2011-06-10 11:12:33,"
131
147
"color,color,red,"
148
+ "address,address,ppr://1235/,"
132
149
"distributed_by,distributed by,Walmart,"
133
150
"knuckles,knuckles,[Knuckle of hardness 2.35,Knuckle of hardness 1.10,],"
134
151
"jambs,jambs,[],"
@@ -267,6 +284,7 @@ def test_tag_is_registered(self):
267
284
"width,width,15,"
268
285
"manufacture_date,manufacture date,2011-06-10 11:12:33,"
269
286
"color,color,red,"
287
+ "address,address,ppr://1235/,"
270
288
"distributed_by,distributed by,Walmart,"
271
289
"knuckles,knuckles,[Knuckle of hardness 2.35,Knuckle of hardness 1.10,],"
272
290
"jambs,jambs,[],"
@@ -306,7 +324,7 @@ def test_with_excluded_fields(self):
306
324
307
325
template = Template (('{% load model_tags %}'
308
326
'{% with pepulator_factory_pepulator_detail_template="pepulator_factory/pepulator_detail.html" %}'
309
- '{% with pepulator_factory_pepulator_exclude="knuckles, jambs, color" %}'
327
+ '{% with pepulator_factory_pepulator_exclude="knuckles, jambs, color, address " %}'
310
328
'{% detail_block pepulator %}'
311
329
'{% endwith %}'
312
330
'{% endwith %}' ))
@@ -362,6 +380,7 @@ def test_tag_is_registered(self):
362
380
"width,width,15,"
363
381
"manufacture_date,manufacture date,2011-06-10 11:12:33,"
364
382
"color,color,red,"
383
+ "address,address,ppr://1235/,"
365
384
"distributed_by,distributed by,Walmart,"
366
385
"knuckles,knuckles,[Knuckle of hardness 2.35,Knuckle of hardness 1.10,],"
367
386
"jambs,jambs,[],"
0 commit comments