Commit 6172c9c6 authored by Daniel W Bond's avatar Daniel W Bond

search page login protected; listing charts not

parent a5917739
......@@ -5,6 +5,9 @@ from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
from django.views.decorators.cache import cache_page
from django.contrib.auth.decorators import login_required
# third party imports
from haystack.views import SearchView
# imports from your apps
from .views import HomepageView, ChartsView
......@@ -23,13 +26,13 @@ urlpatterns = patterns('',
url(r'^mod/', include('mod.urls')),
# search
url(r'^search/', include('haystack.urls'), name='search'),
url(r'^search/', login_required(SearchView(), login_url='login'), name='search'),
# site-wide pages
# homepage is weird for cacheing... no special url, but different content
# for each user
url(r'^$', HomepageView.as_view(), name='homepage'),
url(r'^charts/?$', cache_page(60 * 10)(ChartsView.as_view()), name='charts'),
url(r'^charts/?$', ChartsView.as_view(), name='charts'),
# static pages
url(r'^about/?$',
......
......@@ -21,7 +21,7 @@ class HomepageView(TemplateView):
return context
class ChartsView(LoginRequiredMixin, TemplateView):
class ChartsView(TemplateView):
template_name = 'charts.html'
login_url = 'login'
......
......@@ -10,6 +10,10 @@ SRCT Bookshare • Charts
{% load trades_extras %}
{% load cache %}
{% cache 600 ChartsNotToolbar %}
<div class="page-header" id="banner">
<div class="row">
<div class="col-lg-12 text-center">
......@@ -82,4 +86,6 @@ SRCT Bookshare &bull; Charts
</div>
</div>
{% endcache %}
{% endblock content %}
......@@ -15,10 +15,10 @@
{% if user.is_authenticated %}
<li><a href="{% url 'create_listing' %}">Create Listing</a></li>
<li><a href="{% url 'list_listings' %}">Latest Listings</a></li>
<li><a href="{% url 'charts' %}">Listing Charts</a></li>
{% else %}
<li><a href="{% url 'about' %}">About</a></li>
{% endif %}
<li><a href="{% url 'charts' %}">Listing Charts</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
{% if user.is_authenticated %}
......
......@@ -52,6 +52,11 @@ class ListingForm(forms.ModelForm):
self.fields['description'].label = "Other Notes"
self.fields['photo'].required = False
def clean(self):
cleaned_data = super(ListingForm, self).clean()
print cleaned_data
return super(ListingForm, self).clean()
class Meta:
model = Listing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment