Attempt to show IP address instead of invoice number
This commit is contained in:
		
					parent
					
						
							
								6d4af0c193
							
						
					
				
			
			
				commit
				
					
						73f7831744
					
				
			
		
					 2 changed files with 20 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -1164,6 +1164,24 @@ class InvoiceListView(LoginRequiredMixin, ListView):
 | 
			
		|||
    model = MonthlyHostingBill
 | 
			
		||||
    ordering = '-created'
 | 
			
		||||
 | 
			
		||||
    def get_context_data(self, **kwargs):
 | 
			
		||||
        context = super(InvoiceListView, self).get_context_data(**kwargs)
 | 
			
		||||
        mabs = MonthlyHostingBill.objects.filter(
 | 
			
		||||
            customer__user=self.request.user
 | 
			
		||||
        )
 | 
			
		||||
        ips_dict = {}
 | 
			
		||||
        for mab in mabs:
 | 
			
		||||
            try:
 | 
			
		||||
                vm_detail = VMDetail.get(vm_id=mab.order.vm_id)
 | 
			
		||||
                ips_dict[mab.invoice_number] = [vm_detail.ipv6, vm_detail.ipv4]
 | 
			
		||||
            except VMDetail.DoesNotExist as dne:
 | 
			
		||||
                ips_dict[mab.invoice_number] = ['--']
 | 
			
		||||
                logger.debug("VMDetail for {} doesn't exist".format(
 | 
			
		||||
                    mab.order.vm_id
 | 
			
		||||
                ))
 | 
			
		||||
        context['ips'] = ips_dict
 | 
			
		||||
        return context
 | 
			
		||||
 | 
			
		||||
    def get_queryset(self):
 | 
			
		||||
        user = self.request.user
 | 
			
		||||
        self.queryset = MonthlyHostingBill.objects.filter(customer__user=user)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue