diff options
author | luxagraf <sng@luxagraf.net> | 2020-08-15 11:58:34 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2020-08-15 11:58:34 -0400 |
commit | b66d000ee469539ce7aea557b612c0444177e36d (patch) | |
tree | 273547921dc6f9ded2a5681b82514c68e28ba448 /app/unused_apps/expenses/views.py | |
parent | d3e57c1bd17ad3e71810235a672d4782136901a5 (diff) |
archived old unused apps and migrated fieldnotes to posts
Diffstat (limited to 'app/unused_apps/expenses/views.py')
-rw-r--r-- | app/unused_apps/expenses/views.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/unused_apps/expenses/views.py b/app/unused_apps/expenses/views.py new file mode 100644 index 0000000..98a4c70 --- /dev/null +++ b/app/unused_apps/expenses/views.py @@ -0,0 +1,38 @@ +from django.views.generic import ListView + +from .models import LuxExpense, Expense, Trip, CATS + +class ExpenseListView(ListView): + model = Expense + context_object_name = 'object_list' + template_name = 'details/expenses.html' + + def get_queryset(self): + return Expense.objects.filter( + trip__slug=self.kwargs['slug'] + ) + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(ExpenseListView, self).get_context_data(**kwargs) + context['categories'] = CATS + return context + +class LuxExpenseListView(ListView): + model = LuxExpense + context_object_name = 'object_list' + template_name = 'details/expenses.html' + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(LuxExpenseListView, self).get_context_data(**kwargs) + context['categories'] = CATS + return context + +class TripListView(ListView): + model = Trip + context_object_name = 'object_list' + template_name = 'archives/expenses.html' + + def get_queryset(self): + return Trip.objects.all() |