Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_all(model):
- '''
- Return an queryset of all objects of model given.
- lambda model: SD.models.__getattribute__(model).objects.all()
- '''
- return estoque.models.__getattribute__(model).objects.all()
- def lista(request, model):
- '''
- Listagem geral de registros dos models.
- Fornecedor, Produto, Vendedor, ...
- '''
- lista = get_all(model.title())
- return render_to_response('%ss.html' % model, {'%ss' % model:lista})
- # Plus: Use pagination =)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement