diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/LICENSE.txt b/LICENSE.txt old mode 100644 new mode 100755 diff --git a/README.rst b/README.rst old mode 100644 new mode 100755 diff --git a/tango_with_django_project/manage.py b/tango_with_django_project/manage.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/media/profile_images/sample_profile.jpg b/tango_with_django_project/media/profile_images/sample_profile.jpg old mode 100644 new mode 100755 diff --git a/tango_with_django_project/media/rango.jpg b/tango_with_django_project/media/rango.jpg old mode 100644 new mode 100755 diff --git a/tango_with_django_project/populate_rango.py b/tango_with_django_project/populate_rango.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/rango/__init__.py b/tango_with_django_project/rango/__init__.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/rango/admin.py b/tango_with_django_project/rango/admin.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/rango/bing_search.py b/tango_with_django_project/rango/bing_search.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/rango/forms.py b/tango_with_django_project/rango/forms.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/rango/models.py b/tango_with_django_project/rango/models.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/rango/tests.py b/tango_with_django_project/rango/tests.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/rango/urls.py b/tango_with_django_project/rango/urls.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/rango/views.py b/tango_with_django_project/rango/views.py old mode 100644 new mode 100755 index d478e0e..ab8117d --- a/tango_with_django_project/rango/views.py +++ b/tango_with_django_project/rango/views.py @@ -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 diff --git a/tango_with_django_project/static/css/bootstrap-fluid-adj.css b/tango_with_django_project/static/css/bootstrap-fluid-adj.css old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/css/bootstrap-responsive.css b/tango_with_django_project/static/css/bootstrap-responsive.css old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/css/bootstrap-responsive.min.css b/tango_with_django_project/static/css/bootstrap-responsive.min.css old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/css/bootstrap.css b/tango_with_django_project/static/css/bootstrap.css old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/css/bootstrap.min.css b/tango_with_django_project/static/css/bootstrap.min.css old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/img/glyphicons-halflings-white.png b/tango_with_django_project/static/img/glyphicons-halflings-white.png old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/img/glyphicons-halflings.png b/tango_with_django_project/static/img/glyphicons-halflings.png old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/img/twd.ico b/tango_with_django_project/static/img/twd.ico old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/js/bootstrap.js b/tango_with_django_project/static/js/bootstrap.js old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/js/bootstrap.min.js b/tango_with_django_project/static/js/bootstrap.min.js old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/js/jquery-2.0.3.js b/tango_with_django_project/static/js/jquery-2.0.3.js old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/js/jquery-2.0.3.min.js b/tango_with_django_project/static/js/jquery-2.0.3.min.js old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/js/rango-ajax.js b/tango_with_django_project/static/js/rango-ajax.js old mode 100644 new mode 100755 diff --git a/tango_with_django_project/static/rango.jpg b/tango_with_django_project/static/rango.jpg old mode 100644 new mode 100755 diff --git a/tango_with_django_project/tango_with_django_project/__init__.py b/tango_with_django_project/tango_with_django_project/__init__.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/tango_with_django_project/settings.py b/tango_with_django_project/tango_with_django_project/settings.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/tango_with_django_project/urls.py b/tango_with_django_project/tango_with_django_project/urls.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/tango_with_django_project/wsgi.py b/tango_with_django_project/tango_with_django_project/wsgi.py old mode 100644 new mode 100755 diff --git a/tango_with_django_project/templates/rango/about.html b/tango_with_django_project/templates/rango/about.html old mode 100644 new mode 100755 diff --git a/tango_with_django_project/templates/rango/add_category.html b/tango_with_django_project/templates/rango/add_category.html old mode 100644 new mode 100755 diff --git a/tango_with_django_project/templates/rango/add_page.html b/tango_with_django_project/templates/rango/add_page.html old mode 100644 new mode 100755 index b92fb63..2de6c6b --- a/tango_with_django_project/templates/rango/add_page.html +++ b/tango_with_django_project/templates/rango/add_page.html @@ -9,23 +9,26 @@

Add a Page


- - -
- - {% csrf_token %} - {% for hidden in form.hidden_fields %} - {{ hidden }} - {% endfor %} - - {% for field in form.visible_fields %} - {{ field.errors }}
- {{ field.help_text}} - {{ field }} - {% endfor %} -
- -
+ + {% if not category_name_url %} +
The specified category does not exist!
+ {% else %} +
+ + {% csrf_token %} + {% for hidden in form.hidden_fields %} + {{ hidden }} + {% endfor %} + + {% for field in form.visible_fields %} + {{ field.errors }}
+ {{ field.help_text}} + {{ field }} + {% endfor %} +
+ +
+ {% endif %}
{% endblock %} diff --git a/tango_with_django_project/templates/rango/base.html b/tango_with_django_project/templates/rango/base.html old mode 100644 new mode 100755 diff --git a/tango_with_django_project/templates/rango/category.html b/tango_with_django_project/templates/rango/category.html old mode 100644 new mode 100755 diff --git a/tango_with_django_project/templates/rango/category_list.html b/tango_with_django_project/templates/rango/category_list.html old mode 100644 new mode 100755 diff --git a/tango_with_django_project/templates/rango/index.html b/tango_with_django_project/templates/rango/index.html old mode 100644 new mode 100755 diff --git a/tango_with_django_project/templates/rango/login.html b/tango_with_django_project/templates/rango/login.html old mode 100644 new mode 100755 diff --git a/tango_with_django_project/templates/rango/page_list.html b/tango_with_django_project/templates/rango/page_list.html old mode 100644 new mode 100755 diff --git a/tango_with_django_project/templates/rango/profile.html b/tango_with_django_project/templates/rango/profile.html old mode 100644 new mode 100755 diff --git a/tango_with_django_project/templates/rango/register.html b/tango_with_django_project/templates/rango/register.html old mode 100644 new mode 100755 diff --git a/tango_with_django_project/templates/rango/restricted.html b/tango_with_django_project/templates/rango/restricted.html old mode 100644 new mode 100755 diff --git a/tango_with_django_project/templates/rango/search.html b/tango_with_django_project/templates/rango/search.html old mode 100644 new mode 100755