Commit 9e9387fb authored by frekk's avatar frekk

moved make_pending_membership to register.py

parent 05920eef
......@@ -12,15 +12,6 @@ from memberdb.models import Member, Membership, get_membership_type
from memberdb.forms import MyModelForm
from memberdb.views import MyUpdateView
def make_pending_membership(member):
# check if this member already has a pending membership
ms = Membership.objects.filter(member=member, approved__exact=False).first()
if (ms is None):
ms = Membership(member=member, approved=False)
ms.date_submitted = timezone.now()
ms.membership_type = get_membership_type(member)
return ms
"""
inline admin change list action buttons
see https://medium.com/@hakibenita/how-to-add-custom-action-buttons-to-django-admin-8d266f5b0d41
......
......@@ -3,6 +3,7 @@ from django.db.models import F
from django.core.validators import RegexValidator
from django.core.management.utils import get_random_string
from django.urls import reverse
from django.utils import timezone
from squarepay.dispense import get_item_price
import subprocess
......@@ -98,6 +99,14 @@ def get_membership_type(member):
break
return best
def make_pending_membership(member):
# check if this member already has a pending membership
ms = Membership.objects.filter(member=member, approved__exact=False).first()
if (ms is None):
ms = Membership(member=member, approved=False)
ms.date_submitted = timezone.now()
ms.membership_type = get_membership_type(member)
return ms
def make_token():
return get_random_string(128)
......
......@@ -13,10 +13,9 @@ from django import forms
from squarepay.models import MembershipPayment
from squarepay.dispense import get_item_price
from .models import Member, Membership, get_membership_choices, MEMBERSHIP_TYPES
from .models import Member, Membership, get_membership_choices, make_pending_membership, MEMBERSHIP_TYPES
from .forms import MyModelForm
from .views import MyUpdateView
from .approve import make_pending_membership
"""
First step: enter an email address and some details (to fill at least a Member model) to create a pending membership.
......
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