Fix misc bugs

This commit is contained in:
Kevin Chung
2020-08-20 16:38:52 -04:00
parent e819659d97
commit 2022af2433
5 changed files with 65 additions and 47 deletions

View File

@@ -211,6 +211,7 @@ class TeamSchema(ma.ModelSchema):
else:
target_team = current_team
if self.view == "admin":
provided_ids = []
for f in fields:
f.pop("id", None)

View File

@@ -205,6 +205,7 @@ class UserSchema(ma.ModelSchema):
else:
target_user = current_user
if self.view == "admin":
provided_ids = []
for f in fields:
f.pop("id", None)

View File

@@ -11,6 +11,19 @@ function createTeam(event) {
event.preventDefault();
const params = $("#team-info-create-form").serializeJSON(true);
params.fields = [];
for (const property in params) {
if (property.match(/fields\[\d+\]/)) {
let field = {};
let id = parseInt(property.slice(7, -1));
field["field_id"] = id;
field["value"] = params[property];
params.fields.push(field);
delete params[property];
}
}
CTFd.fetch("/api/v1/teams", {
method: "POST",
credentials: "same-origin",

File diff suppressed because one or more lines are too long

View File

@@ -15,14 +15,17 @@
</div>
<div class="form-group">
{{ form.website.label }}
<small class="float-right text-muted align-text-bottom">Optional</small>
{{ form.website(class="form-control") }}
</div>
<div class="form-group">
{{ form.affiliation.label }}
<small class="float-right text-muted align-text-bottom">Optional</small>
{{ form.affiliation(class="form-control") }}
</div>
<div class="form-group">
{{ form.country.label }}
<small class="float-right text-muted align-text-bottom">Optional</small>
{{ form.country(class="form-control custom-select") }}
</div>