Create an InvoiceListView
This commit is contained in:
		
					parent
					
						
							
								71832f8afc
							
						
					
				
			
			
				commit
				
					
						dbe3b2558c
					
				
			
		
					 1 changed files with 17 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -61,7 +61,7 @@ from .forms import (
 | 
			
		|||
from .mixins import ProcessVMSelectionMixin, HostingContextMixin
 | 
			
		||||
from .models import (
 | 
			
		||||
    HostingOrder, HostingBill, HostingPlan, UserHostingKey, VMDetail,
 | 
			
		||||
    GenericProduct
 | 
			
		||||
    GenericProduct, MonthlyHostingBill
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
logger = logging.getLogger(__name__)
 | 
			
		||||
| 
						 | 
				
			
			@ -1146,6 +1146,22 @@ class OrdersHostingListView(LoginRequiredMixin, ListView):
 | 
			
		|||
        return super(OrdersHostingListView, self).get(request, *args, **kwargs)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class InvoiceListView(OrdersHostingListView):
 | 
			
		||||
    template_name = "hosting/invoices.html"
 | 
			
		||||
    context_object_name = "invoices"
 | 
			
		||||
    model = MonthlyHostingBill
 | 
			
		||||
    ordering = '-created'
 | 
			
		||||
 | 
			
		||||
    def get_queryset(self):
 | 
			
		||||
        user = self.request.user
 | 
			
		||||
        self.queryset = MonthlyHostingBill.objects.filter(customer__user=user)
 | 
			
		||||
        return super(InvoiceListView, self).get_queryset()
 | 
			
		||||
 | 
			
		||||
    @method_decorator(decorators)
 | 
			
		||||
    def get(self, request, *args, **kwargs):
 | 
			
		||||
        return super(InvoiceListView, self).get(request, *args, **kwargs)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class OrdersHostingDeleteView(LoginRequiredMixin, DeleteView):
 | 
			
		||||
    login_url = reverse_lazy('hosting:login')
 | 
			
		||||
    success_url = reverse_lazy('hosting:orders')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue