Skip to content

Commit 762d924

Browse files
orfticosax
authored andcommitted
Use model_class instead of retrieving the whole object in FSMLog (#41)
* Use `model_class` instead of retrieving the whole object
1 parent b3a39b2 commit 762d924

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

django_fsm_log/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def __str__(self):
4242
)
4343

4444
def get_state_display(self):
45-
fsm_obj = self.content_object
46-
for field in fsm_obj._meta.fields:
45+
fsm_cls = self.content_type.model_class()
46+
for field in fsm_cls._meta.fields:
4747
if isinstance(field, FSMFieldMixin):
4848
state_display = dict(field.flatchoices).get(self.state, self.state)
4949
return force_text(state_display, strings_only=True)

0 commit comments

Comments
 (0)