我试图通过使用@list_route标记来添加新端点但是当我尝试导入时:
from rest_framework.decorators import list_route
它无法找到它。我是否需要为此安装一些东西(我是django的新手)?
答案 0 :(得分:4)
升级到更高版本时,您可能会再次遇到此问题。
已弃用<ion-row>
<ion-col col-12>
<ion-card>
<ion-card-header>
<h1>Companies</h1>
</ion-card-header>
<ion-card-content>
<ion-row>
<ion-col col-md-4>
<ion-label>Comp</ion-label>
<ion-select [(ngModel)]="filter_data_quick_sector" multiple="true" interface="popover"
(ionChange)="quickSearch()">
<ion-option *ngFor="let sector of sectors" value="{{ sector }}">{{ sector }}</ion-option>
</ion-select>
</ion-col>
<ion-col col-md-4>
<ion-label>Country</ion-label>
<ion-select [(ngModel)]="filter_data_quick_country" multiple="true" interface="popover"
(ionChange)="quickSearch()">
<ion-option *ngFor="let country of countries" value="{{ country }}">{{ country }}</ion-option>
</ion-select>
</ion-col>
<ion-col col-md-4>
<ion-label>Investment</ion-label>
<ion-select [(ngModel)]="filter_data_quick_investment_type" multiple="true" interface="popver"
(ionChange)="quickSearch()">
<ion-option *ngFor="let investment_type of investment_types" value="{{ investment_type }}">{{
investment_type }}
</ion-option>
</ion-select>
**<ion-row text-right>
<ion-col col-md-6 offset-1="">
<ion-buttons slot="primary" fill="solid" style="--background:blue" size="small">
Press Button
</ion-buttons>
</ion-col>
</ion-row>**
</ion-col>
</ion-row>
<ion-row>
,而赞成list_route
答案 1 :(得分:2)
版本3.1.3中存在list_route
装饰器。
请参阅:https://github.com/tomchristie/django-rest-framework/blob/3.1.3/rest_framework/decorators.py
按照https://github.com/tomchristie/django-rest-framework上的说明正确安装Django REST Framework。
要安装3.1.3版,请运行:pip install djangorestframework==3.1.3