diff --git a/membershipworks/models.py b/membershipworks/models.py index 4098eff..b599b59 100644 --- a/membershipworks/models.py +++ b/membershipworks/models.py @@ -556,6 +556,8 @@ class EventExt(Event): return reverse("membershipworks:event-detail", kwargs={"eid": self.eid}) def user_is_instructor(self, user: AbstractBaseUser) -> bool: + if self.instructor is None: + return False member = Member.from_user(user) if member is not None: return self.instructor.member == member diff --git a/membershipworks/templates/membershipworks/event_invoice.dj.html b/membershipworks/templates/membershipworks/event_invoice.dj.html index eda8c23..716a2cb 100644 --- a/membershipworks/templates/membershipworks/event_invoice.dj.html +++ b/membershipworks/templates/membershipworks/event_invoice.dj.html @@ -55,16 +55,22 @@
-

From:

-
{{ event.instructor.member.account_name }}
-
{{ event.instructor.member.address_street }}
-
- {{ event.instructor.member.address_city }}, - {{ event.instructor.member.address_state_province }} - {{ event.instructor.member.address_postal_code }} -
-
{{ event.instructor.member.email }}
-
{{ event.instructor.member.phone }}
+ {% if event.instructor is None %} +
No instructor has been defined for this event
+ {% elif event.instructor.member is None %} +
Instructor is not a member, so no address information is known
+ {% else %} +

From:

+
{{ event.instructor.member.account_name }}
+
{{ event.instructor.member.address_street }}
+
+ {{ event.instructor.member.address_city }}, + {{ event.instructor.member.address_state_province }} + {{ event.instructor.member.address_postal_code }} +
+
{{ event.instructor.member.email }}
+
{{ event.instructor.member.phone }}
+ {% endif %}