@@ -76,6 +76,10 @@ def shot_create(request, administrator): |
||
| 76 | 76 |
sn = request.POST.get('sn', '')
|
| 77 | 77 |
tenancy_status = request.POST.get('tenancy_status', 0)
|
| 78 | 78 |
|
| 79 |
+ if TenancyShotInfo.objects.filter(model_id=model_id, sn=sn).exists(): |
|
| 80 |
+ return response(TenancyStatusCode.TENANCY_SHOT_ALREADY_EXIST) |
|
| 81 |
+ |
|
| 82 |
+ |
|
| 79 | 83 |
shot = TenancyShotInfo.objects.create( |
| 80 | 84 |
model_id=model_id, |
| 81 | 85 |
model_name=model_name, |
@@ -216,5 +216,6 @@ class MaintenanceStatusCode(BaseStatusCode): |
||
| 216 | 216 |
class TenancyStatusCode(BaseStatusCode): |
| 217 | 217 |
""" 租赁相关错误码 5090xx """ |
| 218 | 218 |
TENANCY_SHOT_NOT_FOUND = StatusCodeField(509001, 'Tenancy Shot Not Found', description=u'租赁镜头不存在') |
| 219 |
+ TENANCY_SHOT_ALREADY_EXIST = StatusCodeField(509002, 'Tenancy Shot Already Exist', description=u'租赁镜头已存在') |
|
| 219 | 220 |
|
| 220 | 221 |
TENANCY_SHOT_REQUEST_NOT_FOUND = StatusCodeField(509011, 'Tenancy Shot Request Not Found', description=u'租赁镜头申请不存在') |