756 generic data fields (#1608)

* Adds the ability to add custom user fields for registration/profile settings
* Admins can create fields that users can optionally edit 
* Works on #756
This commit is contained in:
Kevin Chung
2020-08-19 20:18:37 -04:00
committed by GitHub
parent 0bc58d5af1
commit fb454b8262
60 changed files with 1715 additions and 51 deletions

View File

@@ -22,6 +22,7 @@ from CTFd.models import (
Challenges,
Comments,
Fails,
Fields,
Files,
Flags,
Hints,
@@ -458,6 +459,30 @@ def gen_comment(db, content="comment", author_id=None, type="challenge", **kwarg
return comment
def gen_field(
db,
name="CustomField",
type="user",
field_type="text",
description="CustomFieldDescription",
required=True,
public=True,
editable=True,
):
field = Fields(
name=name,
type=type,
field_type=field_type,
description=description,
required=required,
public=public,
editable=editable,
)
db.session.add(field)
db.session.commit()
return field
def simulate_user_activity(db, user):
gen_tracking(db, user_id=user.id)
gen_award(db, user_id=user.id)