Skip to content

Commit

Permalink
Merge pull request #794 from Studio-Yandex-Practicum/bugfix/fix-crash…
Browse files Browse the repository at this point in the history
…-when-target-model-is-none

Test target_model before reading from it
  • Loading branch information
AntonZelinsky authored Aug 31, 2024
2 parents b8f8597 + dca1290 commit a3f2a36
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/afisha/admin/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def is_paid(self, obj):

@admin.display(description="Тип")
def custom_type(self, obj):
return obj.common_event.target_model.custom_type
model = obj.common_event.target_model
return model.custom_type if model else ""

class Media:

Expand Down

0 comments on commit a3f2a36

Please sign in to comment.