Skip to content

Commit

Permalink
Updated code to reflect change in add_page view and template
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwelld90 committed Jan 7, 2014
1 parent c2b7742 commit bddfa79
Show file tree
Hide file tree
Showing 46 changed files with 27 additions and 19 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LICENSE.txt
100644 → 100755
Empty file.
Empty file modified README.rst
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/manage.py
100644 → 100755
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified tango_with_django_project/media/rango.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified tango_with_django_project/populate_rango.py
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/rango/__init__.py
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/rango/admin.py
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/rango/bing_search.py
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/rango/forms.py
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/rango/models.py
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/rango/tests.py
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/rango/urls.py
100644 → 100755
Empty file.
9 changes: 7 additions & 2 deletions tango_with_django_project/rango/views.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,13 @@ def add_page(request, category_name_url):
page = form.save(commit=False)

# Retrieve the associated Category object so we can add it.
cat = Category.objects.get(name=category_name)
page.category = cat
try:
cat = Category.objects.get(name=category_name)
page.category = cat
except Category.DoesNotExist:
return render_to_response( 'rango/add_page.html',
context_dict,
context)

# Also, create a default value for the number of views.
page.views = 0
Expand Down
Empty file modified tango_with_django_project/static/css/bootstrap-fluid-adj.css
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/static/css/bootstrap-responsive.css
100644 → 100755
Empty file.
Empty file.
Empty file modified tango_with_django_project/static/css/bootstrap.css
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/static/css/bootstrap.min.css
100644 → 100755
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified tango_with_django_project/static/img/glyphicons-halflings.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified tango_with_django_project/static/img/twd.ico
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/static/js/bootstrap.js
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/static/js/bootstrap.min.js
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/static/js/jquery-2.0.3.js
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/static/js/jquery-2.0.3.min.js
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/static/js/rango-ajax.js
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/static/rango.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified tango_with_django_project/tango_with_django_project/__init__.py
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/tango_with_django_project/settings.py
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/tango_with_django_project/urls.py
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/tango_with_django_project/wsgi.py
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/templates/rango/about.html
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/templates/rango/add_category.html
100644 → 100755
Empty file.
37 changes: 20 additions & 17 deletions tango_with_django_project/templates/rango/add_page.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,26 @@ <h1>Add a Page</h1>
<br/>

<div class="container">


<form class="span6" id="page_form" method="post" action="/rango/category/{{category_name_url}}/add_page/">

{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}

{% for field in form.visible_fields %}
{{ field.errors }}<br/>
{{ field.help_text}}
{{ field }}
{% endfor %}
<br/>
<input class="btn btn-primary" type="submit" name="submit" value="Create Page"/>
</form>

{% if not category_name_url %}
<div style="color: red;">The specified category does not exist!</div>
{% else %}
<form class="span6" id="page_form" method="post" action="/rango/category/{{category_name_url}}/add_page/">

{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}

{% for field in form.visible_fields %}
{{ field.errors }}<br/>
{{ field.help_text}}
{{ field }}
{% endfor %}
<br/>
<input class="btn btn-primary" type="submit" name="submit" value="Create Page"/>
</form>
{% endif %}
</div>
</div>
{% endblock %}
Empty file modified tango_with_django_project/templates/rango/base.html
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/templates/rango/category.html
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/templates/rango/category_list.html
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/templates/rango/index.html
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/templates/rango/login.html
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/templates/rango/page_list.html
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/templates/rango/profile.html
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/templates/rango/register.html
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/templates/rango/restricted.html
100644 → 100755
Empty file.
Empty file modified tango_with_django_project/templates/rango/search.html
100644 → 100755
Empty file.

0 comments on commit bddfa79

Please sign in to comment.