Add some logger messages

This commit is contained in:
PCoder 2017-12-12 09:53:14 +01:00
parent beefeb62cb
commit 79b4b449d1

View file

@ -671,19 +671,30 @@ class OrdersHostingDetailView(LoginRequiredMixin,
model = HostingOrder model = HostingOrder
def get_object(self, queryset=None): def get_object(self, queryset=None):
logger.debug("Within OrdersHostingDetailView get_object")
try: try:
hosting_order_obj = HostingOrder.objects.get( hosting_order_obj = HostingOrder.objects.get(
pk=self.kwargs.get('pk') pk=self.kwargs.get('pk')
) )
logger.debug("Found HostingOrder obj")
except HostingOrder.DoesNotExist: except HostingOrder.DoesNotExist:
logger.debug("HostingOrder obj not found")
hosting_order_obj = None hosting_order_obj = None
if not self.request.user.has_perm(hosting_order_obj): if not self.request.user.has_perm(hosting_order_obj):
logger.debug(
"User {user} has no perm on HostingOrder {order}".format(
user=self.request.email,
order=hosting_order_obj.id if hosting_order_obj else 'None'
)
)
raise Http404 raise Http404
return hosting_order_obj return hosting_order_obj
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
# Get context # Get context
context = super(DetailView, self).get_context_data(**kwargs) context = super(
OrdersHostingDetailView, self
).get_context_data(**kwargs)
obj = self.get_object() obj = self.get_object()
owner = self.request.user owner = self.request.user
stripe_api_cus_id = self.request.session.get('customer') stripe_api_cus_id = self.request.session.get('customer')