Skip to content

Commit 64f7bf7

Browse files
author
Emmanouil Konstantinidis
committed
Prevent duplicate custom fields
1 parent 7697c09 commit 64f7bf7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

rest_framework_docs/static/rest_framework_docs/js/components/request.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ var Request = React.createClass({
3535
var endpoint = this.state.endpoint;
3636
var fields = endpoint.fields;
3737

38+
// Check if field already exists
39+
if (_.findWhere(fields, {'name': fieldName})) return;
40+
3841
fields.push({
3942
name: fieldName,
4043
required: false,

rest_framework_docs/static/rest_framework_docs/js/dist.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33142,6 +33142,9 @@
3314233142
var endpoint = this.state.endpoint;
3314333143
var fields = endpoint.fields;
3314433144

33145+
// Check if field already exists
33146+
if (_.findWhere(fields, { 'name': fieldName })) return;
33147+
3314533148
fields.push({
3314633149
name: fieldName,
3314733150
required: false,

0 commit comments

Comments
 (0)