Skip to content

Commit

Permalink
Make selecting contributor optional on project creation form.
Browse files Browse the repository at this point in the history
  • Loading branch information
normangilmore committed Nov 25, 2017
1 parent ff1b9a5 commit b02a4b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions researcher/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ class CreateProjectForm(forms.Form):
starting_article_id = forms.IntegerField(min_value=0)
ending_article_id = forms.IntegerField(min_value=0)

contributor_id = SelectContributorId(Contributor.objects.all(),
contributor_id = SelectContributorId(
Contributor.objects.order_by("id").all(),
label="Contributor",
empty_label=None,
help_text=help_select_contributors)
help_text=help_select_contributors
)

# TODO: show min tokens only after Quiz is selected
min_tokens_per_highlight = forms.IntegerField(min_value=0)
Expand Down
6 changes: 5 additions & 1 deletion researcher/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from data.pybossa_api import generate_tasks_worker
from data.pybossa_api import generate_get_taskruns_worker
from data.nlp_exporter import generate_nlp_tasks_worker
from thresher.models import Article, Topic, UserProfile, Project
from thresher.models import Article, Topic, UserProfile, Project, Contributor
from thresher.models import ParserError

def showParserErrorMessages(request):
Expand Down Expand Up @@ -201,13 +201,17 @@ def __init__(self, **kwargs):
def get(self, request):
agg = Article.objects.aggregate(Min('id'), Max('id'))
profile = request.user.userprofile
contributor = None
if Contributor.objects.count() > 0:
contributor = Contributor.objects.order_by("id").first()
# Developers can add "?debugPresenter=true" to the URL to
# have the task presenter set to a script tag pointed at
# the developer's localhost running 'npm run dev' for
# easy debugging in the Pybossa page context.
debug_presenter = request.GET.get("debugPresenter", False)
initial = { 'starting_article_id': agg['id__min'],
'ending_article_id': agg['id__max'],
'contributor_id': contributor,
'min_tokens_per_highlight': 1,
'max_tokens_per_highlight': 10000,
'pybossa_url': profile.pybossa_url,
Expand Down

0 comments on commit b02a4b1

Please sign in to comment.