Added Label based viewing.
This commit is contained in:
parent
159a65786c
commit
f8889d1f0d
|
@ -32,7 +32,7 @@ class Authors (models.Model):
|
|||
current_status = models.SmallIntegerField(default=2, choices=ACTION_CHOICES, help_text="Current Status of the Author")
|
||||
#whether the application to the planet is approved, the approved ones will be shown at the planet
|
||||
is_approved = models.BooleanField(default=1, help_text="Approve Status of the Author")
|
||||
|
||||
|
||||
#planets that the channel belongs to
|
||||
#at the config.ini the entries should be obe of the belows:
|
||||
#label = Personal
|
||||
|
@ -84,8 +84,7 @@ class Entries (models.Model):
|
|||
class Meta:
|
||||
|
||||
ordering = ['-date']
|
||||
|
||||
|
||||
|
||||
def sanitize(self, data):
|
||||
p = re.compile(r'<[^<]*?/?>')
|
||||
return p.sub('', data)
|
||||
|
|
|
@ -160,7 +160,7 @@ def query(request):
|
|||
return render_to_response('main/query.html', {'q_form': form, 'BASE_URL': BASE_URL,'info_area':info_area})
|
||||
|
||||
|
||||
def archive(request,archive_year=None,archive_month=None,archive_day=None):
|
||||
def archive(request,archive_year=None,archive_month=None,archive_day=None,label=None):
|
||||
info_area = 'archive'
|
||||
# This setting gets the content truncated which contains more than <truncate_words> words.
|
||||
truncate_words = 250
|
||||
|
@ -183,19 +183,23 @@ def archive(request,archive_year=None,archive_month=None,archive_day=None):
|
|||
q_text = request.GET['q_text']
|
||||
else:
|
||||
q_text = ""
|
||||
if ('q_label_personal' in request.GET and request.GET['q_label_personal'] == '1'): #If that exists and not empty
|
||||
q_label_personal = request.GET['q_label_personal']
|
||||
if ((label == "personal") or 'q_label_personal' in request.GET and request.GET['q_label_personal'] == '1'): #If that exists and not empty
|
||||
q_label_personal = 1
|
||||
else:
|
||||
q_label_personal = ""
|
||||
if ('q_label_community' in request.GET and request.GET['q_label_community'] == '1'):
|
||||
q_label_community = request.GET['q_label_community']
|
||||
if ((label == "community") or 'q_label_community' in request.GET and request.GET['q_label_community'] == '1'):
|
||||
q_label_community = 1
|
||||
else:
|
||||
q_label_community = ""
|
||||
|
||||
if ('q_label_lkd' in request.GET and request.GET['q_label_lkd']=='1'):
|
||||
q_label_lkd = request.GET['q_label_lkd']
|
||||
if ((label == "lkd") or 'q_label_lkd' in request.GET and request.GET['q_label_lkd']=='1'):
|
||||
q_label_lkd = 1
|
||||
else:
|
||||
q_label_lkd = ""
|
||||
if ((label == "eng") or 'q_label_eng' in request.GET and request.GET['q_label_eng']=='1'):
|
||||
q_label_eng = 1
|
||||
else:
|
||||
q_label_eng = ""
|
||||
#--
|
||||
#--
|
||||
|
||||
|
@ -217,6 +221,9 @@ def archive(request,archive_year=None,archive_month=None,archive_day=None):
|
|||
entries_list = entries_list.filter(entry_id__label_community = 1)
|
||||
if(q_label_lkd):
|
||||
entries_list = entries_list.filter(entry_id__label_lkd = 1)
|
||||
if(q_label_eng):
|
||||
entries_list = entries_list.filter(entry_id__label_eng = 1)
|
||||
|
||||
|
||||
|
||||
# Text search.
|
||||
|
|
|
@ -16,14 +16,18 @@ urlpatterns = patterns('',
|
|||
# Uncomment the next line to enable the admin:
|
||||
(r'^admin/', include(admin.site.urls)),
|
||||
#(r'^archive/$',archive),
|
||||
(r'^main/', 'djagen.collector.views.main'),
|
||||
(r'^main/$', 'djagen.collector.views.main'),
|
||||
(r'^$', 'djagen.collector.views.main'),
|
||||
(r'^kisisel/$', archive, {"label":"personal"}),
|
||||
(r'^topluluk/$', archive, {"label":"community"}),
|
||||
(r'^lkd/$', archive, {"label":"lkd"}),
|
||||
(r'^english/$', archive, {"label":"eng"}),
|
||||
(r'^subscribe/', 'djagen.collector.views.member_subscribe'),
|
||||
(r'^members/', 'djagen.collector.views.list_members'),
|
||||
(r'^archive/$',archive),
|
||||
(r'^archive/(?P<archive_year>\d{4})/$', archive),
|
||||
(r'^archive/(?P<archive_year>\d{4})/(?P<archive_month>\d{1,2})/$', archive),
|
||||
(r'^archive/(?P<archive_year>\d{4})/(?P<archive_month>\d{1,2})/(?P<archive_day>\d{1,2})/$', archive),
|
||||
(r'^djagen/$',main),
|
||||
(r'^query/$',query),
|
||||
)
|
||||
urlpatterns += patterns('',
|
||||
|
|
Loading…
Reference in New Issue
Block a user