Python django.views.generic.base.TemplateView() Examples
The following are 2
code examples of django.views.generic.base.TemplateView().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.views.generic.base
, or try the search function
.
Example #1
Source File: views.py From InvenTree with MIT License | 6 votes |
def get_context_data(self, **kwargs): context = super(TemplateView, self).get_context_data(**kwargs) # TODO - Re-implement this when a less expensive method is worked out # context['starred'] = [star.part for star in self.request.user.starred_parts.all()] # Generate a list of orderable parts which have stock below their minimum values # TODO - Is there a less expensive way to get these from the database # context['to_order'] = [part for part in Part.objects.filter(purchaseable=True) if part.need_to_restock()] # Generate a list of assembly parts which have stock below their minimum values # TODO - Is there a less expensive way to get these from the database # context['to_build'] = [part for part in Part.objects.filter(assembly=True) if part.need_to_restock()] return context
Example #2
Source File: views.py From InvenTree with MIT License | 5 votes |
def post(self, request, *args, **kwargs): """ Handle POST request (which contains search query). Pass the search query to the page template """ context = self.get_context_data() query = request.POST.get('search', '') context['query'] = query return super(TemplateView, self).render_to_response(context)