# HG changeset patch # User Madhusudan.C.S # Date 1295191482 -19800 # Node ID 42156890006d6c6d1eb808d6b993d3bbbd323751 # Parent 7b009bbd2bfc2cb9035314401b3de6bf2e60cd87 Move all the content from create form to edit form for tasks. diff -r 7b009bbd2bfc -r 42156890006d pytask/taskapp/views.py --- a/pytask/taskapp/views.py Sun Jan 16 20:47:43 2011 +0530 +++ b/pytask/taskapp/views.py Sun Jan 16 20:54:42 2011 +0530 @@ -420,11 +420,11 @@ return shortcuts.redirect(textbook_url) else: context.update({"form": form}) - return shortcuts.render_to_response("task/create_textbook.html", context) + return shortcuts.render_to_response("task/edit.html", context) else: form = taskapp_forms.CreateTextbookForm() context.update({"form": form}) - return shortcuts.render_to_response("task/create_textbook.html", context) + return shortcuts.render_to_response("task/edit.html", context) def view_textbook(request, task_id): @@ -509,11 +509,11 @@ return shortcuts.redirect(textbook_url) else: context.update({"form": form}) - return shortcuts.render_to_response("task/edit_textbook.html", context) + return shortcuts.render_to_response("task/edit.html", context) else: form = taskapp_forms.EditTextbookForm(instance=textbook) context.update({"form": form}) - return shortcuts.render_to_response("task/edit_textbook.html", context) + return shortcuts.render_to_response("task/edit.html", context) @login_required def claim_task(request, task_id): @@ -678,6 +678,21 @@ to get tags related to tasks. """ + term = request.GET.get('term', None) + response = [] + + if term: + tag_entities = Tag.objects.filter(name__icontains=term) + response = [tag.name for tag in tag_entities] + + json_response = json.dumps(response) + return http.HttpResponse(json_response) + +def suggest_task_tags(request): + """Returns the tags matching the query for the AJAXy autocomplete + to get tags related to tasks. + """ + taskapp_models.Task.objects.filter(tags) json_response = json.dumps(['abc', 'bca', 'bowbow']) return http.HttpResponse(json_response) diff -r 7b009bbd2bfc -r 42156890006d pytask/templates/task/edit.html --- a/pytask/templates/task/edit.html Sun Jan 16 20:47:43 2011 +0530 +++ b/pytask/templates/task/edit.html Sun Jan 16 20:54:42 2011 +0530 @@ -1,10 +1,23 @@ -{% extends 'base.html' %} +{% extends "base.html" %} {% load form_helpers %} +{% block css %} + +{% endblock %} + +{% block js %} + + +{% endblock %} + {% block content %} -
- {% csrf_token %} - {% as_div_form form %} - -
+ {% as_div_form form "Create Task Form" csrf_token "" "Submit" %} {% endblock %}