def dashboard_events(request):
if "_auth_user_id" not in request.session:
return redirect("/login/")
else:
all_objects = dash_model.objects.all()
Event_count = dash_model.objects.filter(~Q(Flag_tracking=0)).count()
Event2_count = dash_model.objects.filter(~Q(Flag_tracking=3)).count()
Event3_count = dash_model.objects.filter(~Q(Flag_tracking=0)).count() + dash_model.objects.filter(~Q(Flag_tracking=1)).count() + dash_model.objects.filter(~Q(Flag_tracking=2)).count() + dash_model.objects.filter(~Q(Flag_tracking=3)).count() + dash_model.objects.filter(~Q(Flag_tracking=4)).count() + dash_model.objects.filter(~Q(Flag_tracking=5)).count()
Event4_count = dash_model.objects.filter(~Q(Flag_tracking=4)).count()
Event1_percent = (Event1_count/AllEvents_count) * 100
Event2_percent = (Event2_count/AllEvents_count) * 100
eventmember = EventMember.objects.all()
today = date.today()
day = []
print("---@Debug---")
for i in event:
print("Event Title:", i.title)
print("Event start_time", i.start_time.strftime("%A"))
day = i.start_time.strftime("%A")
print("day=", day)
for i in profile_order:
print(i.FirstName)
print(i.Category)
for i in get_all_events:
event_id.append(i.id)
Customer.append(i.Customer_Name)
CustomerName = json.dumps(Customer)
context = {
'event': event,
'event': event,
'eventmember': eventmember,
'today': today,
'profile_order': profile_order
}
def PaymentOptionsView(request, total=0, counter=0):
stripe.api_key = settings.STRIPE_SECRET_KEY
stripe_total = int(total * 100)
description = 'Recruitment Platform - New Order'
data_key = settings.STRIPE_PUBLISHABLE_KEY
if request.method == 'POST':
try:
token = request.POST['stripeToken']
email = request.POST['stripeEmail']
billingName = request.POST['stripeBillingName']
billingAddress1 = request.POST['stripeBillingAddressLine1']
billingcity = request.POST['stripeBillingAddressCity']
billingPostcode = request.POST['stripeBillingAddressZip']
billingCountry = request.POST['stripeBillingAddressCountryCode']
shippingName = request.POST['stripeShippingName']
shippingAddress1 = request.POST['stripeShippingAddressLine1']
shippingcity = request.POST['stripeShippingAddressCity']
shippingPostcode = request.POST['stripeShippingAddressZip']
shippingCountry = request.POST['stripeShippingAddressCountryCode']
# stripe.Customer is Internal Stripe Table to maintain Customer Record
customer = stripe.Customer.create(
email=email,
source=token
)
# Charge is Stripe Internal Table
charge = stripe.Charge.create(
amount = stripe_total,
currency = "USD",
description = description,
customer = customer.id
)
#### Create Order #####
try:
order_details = Order.objects.create(
token = token,
total = total,
emailAddress = email,
billingName = billingName,
billingAddress = billingAddress1,
billingCity = billingcity,
billingPostCode = billingPostcode,
billingCountry = billingCountry,
shippingName = shippingName,
shippingAdress1 = shippingAddress1,
shippingCity = shippingcity,
shippingPostCde = shippingPostcode,
shippingCountry = shippingCountry
)
order_details.save()
try:
print('Email sent to the Customer!')
sendEmail(order_details.id)
#thanksView(request, order_details.id)
except IOError as e:
return e
class SalesView(LoginRequiredMixin, TemplateView):
template_name = 'hotels/sales.html'
def dispatch(self, *args, **kwargs):
user = self.request.user
if not user.is_staff:
return HttpResponse("Not Allowed", status=401)
return super(SalesView, self).dispatch(*args, **kwargs)
def get_context_data(self, *args, **kwargs):
context = super(SalesView, self).get_context_data(*args, **kwargs)
print('@@@@ Debug Inside get_Context_data() .....')
context["qs"] = Order.objects.all()
print(context["qs"])
#context['recent_orders'] = qs.recent()[:5]
return context
Ezapp Solution Case Study
projects delivered
remotely
of a team senior
and middle engineers
employee turnover
rate
customer satisfaction
score
© 2023 Copyright. All rights reserved.