@@ -107,7 +107,7 @@ def response_action(self, request, queryset): # noqa
107107 for x in selected :
108108 try :
109109 pk , version = x .split ("," )
110- except ValueError :
110+ except ValueError : # pragma: no cover
111111 raise ImproperlyConfigured ('`ConcurrencyActionMixin` error.'
112112 'A tuple with `primary_key, version_number` '
113113 'expected: `%s` found' % x )
@@ -255,31 +255,30 @@ class ConcurrentModelAdmin(ConcurrencyActionMixin,
255255 form = ConcurrentForm
256256 formfield_overrides = {forms .VersionField : {'widget' : VersionWidget }}
257257
258- if django .VERSION [:2 ] >= (1 , 11 ):
259- def check (self , ** kwargs ):
260- errors = []
261- if self .fields :
262- version_field = self .model ._concurrencymeta .field
263- if version_field .name not in self .fields :
264- errors .append (
265- Error (
266- 'Missed version field in {} fields definition' .format (self ),
267- hint = "Please add '{}' to the 'fields' attribute" .format (version_field .name ),
268- obj = None ,
269- id = 'concurrency.A001' ,
270- )
258+ def check (self , ** kwargs ):
259+ errors = []
260+ if self .fields :
261+ version_field = self .model ._concurrencymeta .field
262+ if version_field .name not in self .fields :
263+ errors .append (
264+ Error (
265+ 'Missed version field in {} fields definition' .format (self ),
266+ hint = "Please add '{}' to the 'fields' attribute" .format (version_field .name ),
267+ obj = None ,
268+ id = 'concurrency.A001' ,
271269 )
272- if self . fieldsets :
273- version_field = self .model . _concurrencymeta . field
274- fields = flatten ([ v [ 'fields' ] for k , v in self .fieldsets ])
275-
276- if version_field . name not in fields :
277- errors . append (
278- Error (
279- 'Missed version field in {} fieldsets definition' . format ( self ),
280- hint = "Please add '{}' to the ' fieldsets' attribute" .format (version_field . name ),
281- obj = None ,
282- id = 'concurrency.A002' ,
283- )
270+ )
271+ if self .fieldsets :
272+ version_field = self .model . _concurrencymeta . field
273+ fields = flatten ([ v [ 'fields' ] for k , v in self . fieldsets ])
274+
275+ if version_field . name not in fields :
276+ errors . append (
277+ Error (
278+ 'Missed version field in {} fieldsets definition' .format (self ),
279+ hint = "Please add '{}' to the 'fieldsets' attribute" . format ( version_field . name ) ,
280+ obj = None ,
281+ id = 'concurrency.A002' ,
284282 )
285- return errors
283+ )
284+ return errors
0 commit comments