def __init__(self, *args, **kwargs): super(ConceptTaskForm, self).__init__(*args, **kwargs) tasks = Task() choices = [(x['id'], x['name']) for x in tasks.all()] self.fields['tasks'] = forms.ChoiceField(choices=choices) self.helper = FormHelper() self.helper.form_class = "hidden" self.helper.add_input(Submit('submit', 'Submit')) self.helper.add_input(Reset('battery-cancel', 'Cancel', type="button"))
def base(request): # We only need id and name for the home page fields = ["id","name"] concepts = Concept.all(limit=10,order_by="last_updated",fields=fields) tasks = Task.all(limit=10,order_by="last_updated",fields=fields) disorders = Disorder.all(limit=10,order_by="last_updated",fields=fields) theories = Theory.all(limit=7,order_by="last_updated",fields=fields) appname = "The Cognitive Atlas" context = {'appname': appname, 'active':'homepage', 'concepts':concepts, 'tasks':tasks, 'theories':theories, 'disorders':disorders} return context
def all_tasks(request): '''all_tasks returns page with list of all tasks''' tasks = Task.all(order_by="name") return all_nodes(request, tasks, "tasks")