84 lines
2.8 KiB
Python
84 lines
2.8 KiB
Python
from django import forms
|
|
from .models import (
|
|
ReferralRecord,
|
|
ReferralRecordReward,
|
|
GoodTimeCoins,
|
|
ReferralTracking,
|
|
ReferralCode,
|
|
)
|
|
|
|
|
|
class ReferralRecordForm(forms.ModelForm):
|
|
class Meta:
|
|
model = ReferralRecord
|
|
fields = [
|
|
"referrer_principal",
|
|
"referred_principal",
|
|
"principal_type",
|
|
"is_completed",
|
|
]
|
|
widgets = {
|
|
"referrer_principal": forms.Select(attrs={"class": "form-control"}),
|
|
"referred_principal": forms.Select(attrs={"class": "form-control"}),
|
|
"principal_type": forms.Select(attrs={"class": "form-control"}),
|
|
"is_completed": forms.CheckboxInput(attrs={"class": "form-check-input"}),
|
|
}
|
|
help_texts = {
|
|
"referrer_principal": "The principal who referred someone",
|
|
"referred_principal": "The principal who was referred",
|
|
"principal_type": "The type of principal associated with this referral",
|
|
"is_completed": "Indicates whether the referral is completed",
|
|
}
|
|
|
|
|
|
class ReferralRecordRewardForm(forms.ModelForm):
|
|
class Meta:
|
|
model = ReferralRecordReward
|
|
fields = ["referral_record", "subscription", "coins", "value", "sell"]
|
|
|
|
|
|
class GoodTimeCoinsForm(forms.ModelForm):
|
|
class Meta:
|
|
model = GoodTimeCoins
|
|
fields = ["value_in_pound", "comments"]
|
|
|
|
|
|
class ReferralTrackingForm(forms.ModelForm):
|
|
class Meta:
|
|
model = ReferralTracking
|
|
fields = [
|
|
"referral_record",
|
|
"referrer_subscription_id",
|
|
"referred_subscription_id",
|
|
"is_referrer_subscribed",
|
|
"ip_address",
|
|
"user_agent",
|
|
"device_model",
|
|
]
|
|
widgets = {
|
|
"referral_record": forms.Select(attrs={"class": "form-control"}),
|
|
"referrer_subscription_id": forms.NumberInput(
|
|
attrs={"class": "form-control"}
|
|
),
|
|
"referred_subscription_id": forms.NumberInput(
|
|
attrs={"class": "form-control"}
|
|
),
|
|
"is_referrer_subscribed": forms.CheckboxInput(
|
|
attrs={"class": "form-check-input"}
|
|
),
|
|
"ip_address": forms.TextInput(attrs={"class": "form-control"}),
|
|
"user_agent": forms.TextInput(attrs={"class": "form-control"}),
|
|
"device_model": forms.TextInput(attrs={"class": "form-control"}),
|
|
}
|
|
|
|
|
|
class ReferralCodeForm(forms.ModelForm):
|
|
class Meta:
|
|
model = ReferralCode
|
|
fields = ["id", "principal", "principal_type", "referral_code"]
|
|
widgets = {
|
|
"principal": forms.Select(attrs={"class": "form-control"}),
|
|
"principal_type": forms.Select(attrs={"class": "form-control"}),
|
|
"referral_code": forms.TextInput(attrs={"class": "form-control"}),
|
|
}
|