File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -168,7 +168,11 @@ def name(self):
168168 class WrongContext (views .ContextView ):
169169 __model_cls__ = Profile
170170 __include__ = (Profile .wrong_field ,)
171- __exclude__ = (Profile .one_more_wrong_field ,)
171+
172+ with self .assertRaises (AttributeError ):
173+ class WrongContext (views .ContextView ):
174+ __model_cls__ = Profile
175+ __exclude__ = (Profile .wrong_field ,)
172176
173177 def test_context_view (self ):
174178 public_profile = ProfilePublicContext (self .profile )
@@ -262,3 +266,13 @@ def test_context_view(self):
262266 'path' : 'path/to/the/photo3'
263267 }]
264268 })
269+
270+ class SomeContext (views .ContextView ):
271+ __model_cls__ = Profile
272+
273+ @property
274+ def name (self ):
275+ return " + " .join ((self .__model__ .name , "postfix" ))
276+
277+ profile_within_context = SomeContext (self .profile )
278+ self .assertEqual (profile_within_context .name , 'John + postfix' )
You can’t perform that action at this time.
0 commit comments