File tree Expand file tree Collapse file tree 3 files changed +75
-1
lines changed Expand file tree Collapse file tree 3 files changed +75
-1
lines changed Original file line number Diff line number Diff line change 2727
2828
2929class AdminDisplayBug35Admin (admin .ModelAdmin ):
30- list_display = ("text_enum" , "int_enum" )
30+ list_display = (
31+ "text_enum" ,
32+ "int_enum" ,
33+ "status_basic" ,
34+ "status_basic_int" ,
35+ "status_str" ,
36+ "status_int" ,
37+ )
3138 readonly_fields = ("text_enum" , "int_enum" , "blank_int" , "blank_txt" )
3239
3340
Original file line number Diff line number Diff line change @@ -398,3 +398,61 @@ class GNSSConstellation(IntFlag):
398398 GALILEO = 1 << 2
399399 BEIDOU = 1 << 3
400400 QZSS = 1 << 4
401+
402+
403+ class NestStatusBasic (Enum ):
404+ INIT = "INIT"
405+ LOADED = "LOADED"
406+ ACTIVE = "ACTIVE"
407+ DONE = "DONE"
408+ REJECTED = "REJECTED"
409+ CANCELLED = "CANCELLED"
410+
411+ def __hash__ (self ):
412+ return hash (self .value )
413+
414+ def __eq__ (self , value ) -> bool :
415+ if isinstance (value , self .__class__ ):
416+ return self .value == value .value
417+ try :
418+ return self .value == self .__class__ (value ).value
419+ except (ValueError , TypeError ):
420+ return False
421+
422+
423+ class NestStatusStr (str , Enum ):
424+ INIT = "INIT"
425+ LOADED = "LOADED"
426+ ACTIVE = "ACTIVE"
427+ DONE = "DONE"
428+ REJECTED = "REJECTED"
429+ CANCELLED = "CANCELLED"
430+
431+
432+ class NestStatusBasicInt (Enum ):
433+ INIT = 0
434+ LOADED = 1
435+ ACTIVE = 2
436+ DONE = 3
437+ REJECTED = 4
438+ CANCELLED = 5
439+
440+ def __hash__ (self ):
441+ return hash (self .value )
442+
443+ def __eq__ (self , value ) -> bool :
444+ if isinstance (value , self .__class__ ):
445+ return self .value == value .value
446+ try :
447+ return self .value == self .__class__ (value ).value
448+ except (ValueError , TypeError ):
449+ return False
450+
451+
452+ class NestStatusInt (int , Enum ):
453+ INIT = 0
454+ LOADED = 1
455+ ACTIVE = 2
456+ DONE = 3
457+ REJECTED = 4
458+ CANCELLED = 5
Original file line number Diff line number Diff line change 4141 TimeEnum ,
4242 NullableConstants ,
4343 GNSSConstellation ,
44+ NestStatusBasic ,
45+ NestStatusInt ,
46+ NestStatusBasicInt ,
47+ NestStatusStr ,
4448)
4549
4650
@@ -159,6 +163,11 @@ class AdminDisplayBug35(models.Model):
159163
160164 blank_txt = EnumField (TextEnum , null = True , default = None )
161165
166+ status_basic = EnumField (NestStatusBasic , null = True , default = None )
167+ status_basic_int = EnumField (NestStatusBasicInt , null = True , default = None )
168+ status_int = EnumField (NestStatusInt , null = True , default = None )
169+ status_str = EnumField (NestStatusStr , null = True , default = None )
170+
162171
163172class EmptyEnumValueTester (models .Model ):
164173 class BlankTextEnum (TextChoices ):
You can’t perform that action at this time.
0 commit comments