Commit d0b54b7f authored by Thomas Frion's avatar Thomas Frion
Browse files

[FEAT] Search an operation by name, code, asmid

parent 43f5ad00
......@@ -8,7 +8,6 @@ import { ChoucasApi } from 'src/app/pghm-api/ch
import { environment } from 'src/environments/environment';
import { OperationResource, OperationGeoInfoResource } from 'src/app/pghm-api/choucas/resources/operation.resource';
import { OperationInitParams } from './models/operation-inti-params';
import { Router } from '@angular/router';
@Injectable({
providedIn: 'root'
......
......@@ -53,7 +53,11 @@ class OperationList(APIView):
class OperationDetail(APIView):
def get_obj(self, code):
try:
return OperationModel.objects.get(code=code)
if code.isnumeric():
return OperationModel.objects.get(Q(code=code) | Q(name=code) | Q(asmid=code))
else:
return OperationModel.objects.get(Q(code=code) | Q(name=code))
except OperationModel.DoesNotExist:
raise Http404
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment