python - 我如何在其他功能中使用 get_queryset()object 'list_object'
问题描述
class AboutView(ListView):
template_name = 'index.html'
model = Product
def get_queryset(self):
object_list = self.model.objects.all()
return object_list
def get(request, self):
new_list = object_list
return new_list.order_to(-'price')
解决方案
我不知道你的目的。我认为使用self.get_queryset()
。更多细节:https ://www.django-rest-framework.org/api-guide/generic-views/
推荐阅读
- css - -webkit-text-stroke chrome 多行
- gnuradio - 如何使用 GNURadio 传输 AIS 消息
- c# - UWP:如何确保按顺序处理异步事件
- python - 基于ID的累积SUM
- reactjs - 如何将 HOC 与 redux compose 和 Typescript 一起使用
- c# - Find items that are similar amongst them in List in C# with nested For loops and Linq
- javascript - Javascript 中的“异步”实际上创建了一个异步函数吗?
- python-3.x - 根据 ID 和列表返回值的计数
- javascript - 在 Javascript 中用变量声明集合
- android - 如何在 Android 中制作圆形的 Exoplayer PlayerView