Commit 61008f4a authored by frekk's avatar frekk

Merge branch 'frekk-testing' into 'master'

Frekk testing

See merge request frekk/uccportal!8
parents 340b7b39 1c95e4a2
......@@ -129,14 +129,14 @@ def refresh_dispense_payment(modeladmin, request, queryset):
num_changed = 0
membership_list = list(queryset)
for ms in membership_list:
if ms.date_paid is not None:
if ms.date_paid is not None or ms.username == '' or ms.username is None:
if try_update_from_dispense(ms):
num_changed += 1
if num_changed > 0:
messages.success(request, "Updated %d records" % num_changed)
messages.success(request, "Updated %d records of %d total" % (num_changed, len(membership_list)))
messages.warning(request, "No records updated")
......@@ -110,9 +110,9 @@ class MembershipAdmin(admin.ModelAdmin):
Define the admin page for viewing normal Member records (all details included) and approving them
list_display = ['membership_info', 'membership_type', 'payment_method', 'approved', 'date_submitted', 'member_actions', ]
list_display = ['membership_info', 'membership_type', 'payment_method', 'approved', 'date_submitted', 'member_actions']
list_display_links = None
list_filter = ['approved']
list_filter = ['approved', 'payment_method', 'membership_type', 'member__is_student', 'member__is_guild']
readonly_fields = ['date_submitted']
radio_fields = {'payment_method': admin.VERTICAL, 'membership_type': admin.VERTICAL}
actions = [refresh_dispense_payment]
......@@ -75,7 +75,7 @@ class CokeLog:
self.last_offset = self.file.tell()
def get_last_dispense(self, username, item_code=None, dispense_by=None):
if self.dispenses is None:
if self.dispenses is None or not username in self.dispenses:
return None
for r in reversed(self.dispenses[username]):
......@@ -105,7 +105,6 @@ def try_update_from_dispense(membership):
ms_disp = member_cokelog.get_last_dispense(
if ms_disp is not None:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment