membershipworks: Add more useful MW links to EventAdmin change page
This commit is contained in:
parent
d19b2d19fb
commit
59d2ff4cb7
@ -197,6 +197,7 @@ class EventAdmin(DjangoObjectActions, admin.ModelAdmin):
|
|||||||
"instructor_percentage",
|
"instructor_percentage",
|
||||||
"instructor_flat_rate",
|
"instructor_flat_rate",
|
||||||
("should_survey", "survey_email_sent"),
|
("should_survey", "survey_email_sent"),
|
||||||
|
"links",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -206,7 +207,7 @@ class EventAdmin(DjangoObjectActions, admin.ModelAdmin):
|
|||||||
"classes": ["collapse"],
|
"classes": ["collapse"],
|
||||||
"fields": [
|
"fields": [
|
||||||
"eid",
|
"eid",
|
||||||
"_url",
|
"url",
|
||||||
"start",
|
"start",
|
||||||
"end",
|
"end",
|
||||||
"duration",
|
"duration",
|
||||||
@ -251,12 +252,15 @@ class EventAdmin(DjangoObjectActions, admin.ModelAdmin):
|
|||||||
for field in Event._meta.get_fields():
|
for field in Event._meta.get_fields():
|
||||||
if field.auto_created or field.many_to_many or not field.concrete:
|
if field.auto_created or field.many_to_many or not field.concrete:
|
||||||
continue
|
continue
|
||||||
elif field.name == "url":
|
|
||||||
fields.append("_url")
|
|
||||||
else:
|
else:
|
||||||
fields.append(field.name)
|
fields.append(field.name)
|
||||||
fields.insert(fields.index("end") + 1, "duration")
|
fields.insert(fields.index("end") + 1, "duration")
|
||||||
fields += ["details_timestamp", "details", "registrations"]
|
fields += [
|
||||||
|
"links",
|
||||||
|
"details_timestamp",
|
||||||
|
"details",
|
||||||
|
"registrations",
|
||||||
|
]
|
||||||
return fields
|
return fields
|
||||||
|
|
||||||
@admin.display(ordering="title")
|
@admin.display(ordering="title")
|
||||||
@ -267,10 +271,11 @@ class EventAdmin(DjangoObjectActions, admin.ModelAdmin):
|
|||||||
def duration(self, obj):
|
def duration(self, obj):
|
||||||
return obj.duration
|
return obj.duration
|
||||||
|
|
||||||
@admin.display(description="URL")
|
@admin.display(description="MembershipWorks links")
|
||||||
def _url(self, obj):
|
def links(self, obj):
|
||||||
return format_html(
|
return format_html(
|
||||||
'<a href="https://claremontmakerspace.org/events/#!event/{0}">{0}</a>',
|
'<a href="https://membershipworks.com/admin/#!event/admin/{0}">Admin</a> | '
|
||||||
|
'<a href="https://claremontmakerspace.org/events/#!event/{0}">Event List</a>',
|
||||||
obj.url,
|
obj.url,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user