manage coupons list, add, edit, delete views

This commit is contained in:
rizwanisready
2024-07-22 21:08:56 +05:30
parent 473a961ab6
commit 6a8dc781d2
28 changed files with 672 additions and 926 deletions

View File

@@ -1,4 +1,5 @@
from django import forms
from accounts.models import IAmPrincipalType
from manage_subscriptions.models import PrincipalSubscription, Subscription, Plan
@@ -31,7 +32,15 @@ class SubscriptionForm(forms.ModelForm):
"active",
"deleted",
"is_free",
] # Include all fields you want from the model
]
def __init__(self, *args, **kwargs):
super(SubscriptionForm, self).__init__(*args, **kwargs)
event_user = IAmPrincipalType.objects.get(name="event_user")
event_manager = IAmPrincipalType.objects.get(name="event_manager")
self.fields["principal_types"].queryset = IAmPrincipalType.objects.filter(
id__in=[event_user.id, event_manager.id]
)
class PrincipalSubscriptionForm(forms.ModelForm):