Merging latest changes done to my branch into trunk.
This commit is contained in:
parent
04d76c5349
commit
f5416a259d
|
@ -20,7 +20,7 @@ class AuthorsAdmin (admin.ModelAdmin):
|
|||
search_fields = ['author_name', 'author_surname', 'author_email']
|
||||
|
||||
def save_model(self, request, obj, form, change):
|
||||
|
||||
|
||||
#get the values for saving
|
||||
author_name = obj.author_name
|
||||
author_surname = obj.author_surname
|
||||
|
|
|
@ -16,6 +16,6 @@ class ContactForm(forms.Form):
|
|||
captcha = CaptchaField(label="Captcha Alanı", help_text='Gördüğünü karakterleri aynen yazınız', error_messages={'required': 'Hatalı yazdınız!'})
|
||||
|
||||
class QueryForm(forms.Form):
|
||||
name = forms.CharField(max_length=25, required = False, label = 'Adı')
|
||||
surname = forms.CharField(max_length=25, required = False, label = 'Soyadı')
|
||||
text = forms.CharField(required = False, label = 'Aradığınız metin', widget = forms.widgets.Textarea() )
|
||||
q_author_name = forms.CharField(max_length=25, required = False, label = 'Adı')
|
||||
q_author_surname = forms.CharField(max_length=25, required = False, label = 'Soyadı')
|
||||
q_text = forms.CharField(required = False, label = 'Aradığınız metin', widget = forms.widgets.Textarea() )
|
||||
|
|
|
@ -72,12 +72,12 @@ def member_subscribe(request):
|
|||
author = Authors(author_name=request.POST['name'], author_surname=request.POST['surname'], author_email=request.POST['email'], channel_url=request.POST['feed'], author_face=f.name, is_approved=0, current_status=5)
|
||||
else:
|
||||
author = Authors(author_name=request.POST['name'], author_surname=request.POST['surname'], author_email=request.POST['email'], channel_url=request.POST['feed'], is_approved=0, current_status=5)
|
||||
|
||||
|
||||
author.save()
|
||||
|
||||
#save the history with explanation
|
||||
author.history_set.create(action_type=5, action_date=datetime.datetime.now(), action_explanation=request.POST['message'])
|
||||
|
||||
|
||||
#send mail part
|
||||
#fill it here
|
||||
return render_response(request, 'main/subscribe.html/',{'submit': 'done', 'BASE_URL': BASE_URL,'info_area':info_area})
|
||||
|
@ -117,7 +117,12 @@ def list_members(request):
|
|||
|
||||
def query(request):
|
||||
|
||||
return render_response(request,'main/query.html',{'BASE_URL' : BASE_URL})
|
||||
q_form = QueryForm()
|
||||
|
||||
return render_response(request,'main/query.html',{
|
||||
'BASE_URL' : BASE_URL,
|
||||
'q_form':q_form,
|
||||
})
|
||||
|
||||
def archive(request,archive_year='',archive_month='',archive_day=''):
|
||||
|
||||
|
@ -129,31 +134,28 @@ def archive(request,archive_year='',archive_month='',archive_day=''):
|
|||
run_time = RunTime.objects.all()[0]
|
||||
|
||||
|
||||
### Determine if the request includes any query or not. ###
|
||||
try:
|
||||
does_getPage_exists = request.GET['page']
|
||||
except:
|
||||
does_getPage_exists = None
|
||||
### Determine if the request object includes any querying input or not. ###
|
||||
|
||||
if ( (request.GET) and ( not( does_getPage_exists) )):
|
||||
if ( (request.GET) and ('q_author_name' in request.GET or 'q_author_surname' in request.GET or 'q_text' in request.GET ) ):
|
||||
# Switch to 'return the result of query' mode.
|
||||
info_area = 'query'
|
||||
|
||||
#Querying
|
||||
#TODO: We should improve the querying method here.
|
||||
#TODO: We should improve querying method implemented here.
|
||||
q_author_name,q_author_surname,q_text = '','',''
|
||||
authors = Authors.objects.all()
|
||||
if ( ('q_author_name' in request.GET) and (request.GET['q_author_name'] )):
|
||||
q_author_name = request.GET['q_author_name']
|
||||
authors = authors.filter(author_name__icontains = q_author_name)
|
||||
authors = authors.filter(author_name__iexact = q_author_name)
|
||||
|
||||
|
||||
if (('q_author_surname' in request.GET) and (request.GET['q_author_surname'])):
|
||||
q_author_surname = request.GET['q_author_surname']
|
||||
authors = authors.filter(author_surname__icontains = q_author_surname)
|
||||
authors = authors.filter(author_surname__iexact = q_author_surname)
|
||||
|
||||
|
||||
for item in authors:
|
||||
|
||||
try:
|
||||
entries_list |= item.entries_set.all()
|
||||
except:
|
||||
|
@ -161,11 +163,11 @@ def archive(request,archive_year='',archive_month='',archive_day=''):
|
|||
|
||||
if( ('q_text' in request.GET)and(request.GET['q_text'])):
|
||||
q_text = request.GET['q_text']
|
||||
if (q_author_name or q_author_surname):
|
||||
|
||||
try:
|
||||
entries_list |= Entries.objects.filter(content_text__icontains = request.GET['q_text'])
|
||||
except:
|
||||
entries_list = Entries.objects.filter(content_text__icontains = request.GET['q_text'])
|
||||
entries_list = entries_list.filter(content_text__icontains = q_text)
|
||||
else:
|
||||
entries_list = Entries.objects.filter(content_text__icontains = q_text)
|
||||
|
||||
|
||||
|
||||
|
@ -174,8 +176,10 @@ def archive(request,archive_year='',archive_month='',archive_day=''):
|
|||
return HttpResponseRedirect(BASE_URL+"/query")
|
||||
except:
|
||||
return HttpResponseRedirect(BASE_URL+ "/query")
|
||||
|
||||
#here is gonna be edited [X]
|
||||
# Pagination
|
||||
|
||||
elements_in_a_page = 25 # This determines, how many elements will be displayed in a paginator page.
|
||||
paginator = Paginator(entries_list,elements_in_a_page)
|
||||
# Validation for page number if it is not int return first page.
|
||||
|
@ -205,7 +209,7 @@ def archive(request,archive_year='',archive_month='',archive_day=''):
|
|||
### If not ###
|
||||
else:
|
||||
#Switch to return the result of arguments provided mode(archive viewing mode).
|
||||
info_area = 'archive'
|
||||
info_area = 'archive' # \This variable is used for determining which infoarea text should be used in "contenttop" div in /main/base.html
|
||||
|
||||
selected_entries = Entries.objects.select_related()
|
||||
|
||||
|
@ -222,6 +226,7 @@ def archive(request,archive_year='',archive_month='',archive_day=''):
|
|||
else:
|
||||
# Fall back to main view.
|
||||
return HttpResponseRedirect(BASE_URL+"/main")
|
||||
#pass
|
||||
|
||||
# Check if archive_month is not empty and numeric.
|
||||
if(archive_month != ''and (str(archive_month).isalnum()) and not(str(archive_month).isalpha())):
|
||||
|
@ -236,7 +241,7 @@ def archive(request,archive_year='',archive_month='',archive_day=''):
|
|||
# Pagination
|
||||
elements_in_a_page = 25 # This determines, how many elements will be displayed in a paginator page.
|
||||
paginator = Paginator(entries_list,elements_in_a_page)
|
||||
|
||||
|
||||
# Validation for page number if it is not int return first page.
|
||||
try:
|
||||
page = int(request.GET.get('page', '1'))
|
||||
|
|
|
@ -166,16 +166,29 @@ def main():
|
|||
# run the planet
|
||||
my_planet = planet.Planet(config)
|
||||
my_planet.run(planet_name, planet_link, template_files, offline)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## This is where archiving is done! ##
|
||||
#add the current channels to the db
|
||||
channels = my_planet.channels()
|
||||
for channel in channels:
|
||||
|
||||
author_name = channel.name
|
||||
|
||||
### This part seperates surname from name do not activate it if needn't.
|
||||
words = channel.name.split()
|
||||
if len(words) == 1:
|
||||
author_name = words[0]
|
||||
author_surname == None
|
||||
else:
|
||||
author_surname = words[-1]
|
||||
words.pop()
|
||||
tmp_first_name = ''
|
||||
for word in words: tmp_first_name += ' ' + word
|
||||
author_name = tmp_first_name[1:]
|
||||
### ###
|
||||
#print channel.name
|
||||
#author_name = channel.name
|
||||
#author_surname = channel.surname
|
||||
|
||||
try:
|
||||
author_face = channel.face
|
||||
except:
|
||||
|
@ -184,7 +197,7 @@ def main():
|
|||
channel_subtitle = channel.subtitle
|
||||
except:
|
||||
channel_subtitle = None
|
||||
try:
|
||||
try:
|
||||
channel_title = channel.title
|
||||
except:
|
||||
channel_title = None
|
||||
|
@ -200,9 +213,8 @@ def main():
|
|||
channel_urlstatus = channel.url_status
|
||||
except:
|
||||
channel_urlstatus = None
|
||||
|
||||
label = channel.label
|
||||
|
||||
|
||||
label_personal = 0
|
||||
label_lkd = 0
|
||||
label_community = 0
|
||||
|
@ -215,7 +227,6 @@ def main():
|
|||
label_community = 1
|
||||
if label == "Eng":
|
||||
label_eng = 1
|
||||
|
||||
id = channel.id
|
||||
|
||||
try:
|
||||
|
@ -223,6 +234,7 @@ def main():
|
|||
|
||||
#update the values with the ones at the config file
|
||||
author.author_name = author_name
|
||||
author.author_surname = author_surname
|
||||
#print author_name
|
||||
author.author_face = author_face
|
||||
author.channel_subtitle = channel_subtitle
|
||||
|
@ -237,8 +249,8 @@ def main():
|
|||
|
||||
except Exception, ex:
|
||||
#print ex
|
||||
author = Authors(author_id=id, author_name=author_name, author_face=author_face, channel_subtitle=channel_subtitle, channel_title=channel_title, channel_url=channel_url, channel_link=channel_link, channel_urlstatus=channel_urlstatus, label_personal=label_personal, label_lkd=label_lkd, label_community=label_community, label_eng=label_eng)
|
||||
|
||||
author = Authors(author_id=id, author_name=author_name, author_surname=author_surname, author_face=author_face, channel_subtitle=channel_subtitle, channel_title=channel_title, channel_url=channel_url, channel_link=channel_link, channel_urlstatus=channel_urlstatus, label_personal=label_personal, label_lkd=label_lkd, label_community=label_community, label_eng=label_eng)
|
||||
|
||||
|
||||
author.save()
|
||||
|
||||
|
@ -264,7 +276,7 @@ def main():
|
|||
else: summary = item.summary
|
||||
entry = author.entries_set.create(id_hash=id_hash, title=item.title, content_html=item.content, summary=summary, link=item.link, date=datetime.datetime(d[0], d[1], d[2], d[3], d[4], d[5]))
|
||||
entry.content_text = entry.sanitize(content_html)
|
||||
|
||||
|
||||
entry.save()
|
||||
|
||||
#datetime issue
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
{% autoescape off %}
|
||||
|
||||
{% ifequal entry.entry_id.is_approved 1 %}
|
||||
|
||||
|
||||
{% ifchanged entry.date.day entry.date.month entry.date.year %}<div class="separator"></div>{% endifchanged %}
|
||||
|
||||
{% ifchanged %}<h2 class="date">{{ entry.date|date:"d F Y" }}</h2>{% endifchanged %}
|
||||
|
||||
<div class="innercontent">
|
||||
|
||||
<a href="{{ entry.entry_id.channel_link }}" title="{{ entry.entry_id.channel_title }}"><img class="face" src="/djagenmedia/images/heads/{{ entry.entry_id.author_face|default:"nobody.png" }}" title="{{ entry.entry_id.author_name }}" width="80" height="80" /></a>
|
||||
<a href="{{ entry.entry_id.channel_link }}" title="{{ entry.entry_id.channel_title }}"><img class="face" src="/djagenmedia/images/heads/{{ entry.entry_id.author_face|default:"nobody.png" }}" title="{{ entry.entry_id.author_name }} {{ entry.entry_id.author_surname }}" width="80" height="80" /></a>
|
||||
<h1 class="title"><a href="{{ entry.link }} ">{{ entry.title }}</a></h1>
|
||||
<p class="yazaneden">
|
||||
Yazar: <a href="{{ entry.entry_id.channel_link }}" title="{{ entry.entry_id.channel_title }}">{{ entry.entry_id.author_name }}</a>
|
||||
Yazar: <a href="{{ entry.entry_id.channel_link }}" title="{{ entry.entry_id.channel_title }}">{{ entry.entry_id.author_name }} {{ entry.entry_id.author_surname }}</a>
|
||||
Tarih: <span class="blogdate">{{ entry.date|date:"d F Y H:i" }}</span>
|
||||
</p>
|
||||
<div class="blogcontent">
|
||||
|
@ -27,39 +27,70 @@
|
|||
{% endautoescape %}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<div class="pagination">
|
||||
<span class="step-links">
|
||||
|
||||
|
||||
{% if q_author_name or q_author_surname or q_text %}
|
||||
<span class="current">
|
||||
Sayfa <b>{{ p_entries_list.number }}</b> / <b>{{ p_entries_list.paginator.num_pages }}</b>
|
||||
</span>
|
||||
|
||||
<div class="pagelist" style="text-align:center">
|
||||
{% if p_entries_list.has_previous %}
|
||||
<a href="?q_author_name={{ q_author_name }}&q_author_surname={{ q_author_surname }}&q_text={{ q_text }}&page={{ p_entries_list.previous_page_number }}">Geri</a>
|
||||
{% endif %}
|
||||
|
|
||||
|
||||
{% for pNum in p_entries_list.paginator.page_range %}
|
||||
{% ifequal pNum p_entries_list.number %}
|
||||
{{ pNum }}
|
||||
{% else %}
|
||||
<a href="?q_author_name={{ q_author_name }}&q_author_surname={{ q_author_surname }}&q_text={{ q_text }}&page={{ pNum }}">{{ pNum }}</a>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
|
||||
|
|
||||
{% if p_entries_list.has_next %}
|
||||
<a href="?q_author_name={{ q_author_name }}&q_author_surname={{ q_author_surname }}&q_text={{ q_text }}&page={{ p_entries_list.next_page_number }}">İleri</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<span class="current">
|
||||
Sayfa <b>{{ p_entries_list.number }}</b> / <b>{{ p_entries_list.paginator.num_pages }}</b>
|
||||
</span>
|
||||
<div class="pagelist" style="text-align:center">
|
||||
{% if p_entries_list.has_previous %}
|
||||
<a href="?page={{ p_entries_list.previous_page_number }}">Geri</a>
|
||||
{% endif %}
|
||||
|
|
||||
|
||||
{% for pNum in p_entries_list.paginator.page_range %}
|
||||
{% ifequal pNum p_entries_list.number %}
|
||||
{{ pNum }}
|
||||
{% else %}
|
||||
<a href="?page={{ pNum }}">{{ pNum }}</a>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
|
||||
|
|
||||
{% if p_entries_list.has_next %}
|
||||
<a href="?page={{ p_entries_list.next_page_number }}">İleri</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="pagelist" style="text-align:center">
|
||||
{% if p_entries_list.has_previous %}
|
||||
<a href="?q_author_name=?page={{ p_entries_list.previous_page_number }}">Geri</a>
|
||||
{% endif %}
|
||||
|
|
||||
|
||||
{% for pNum in p_entries_list.paginator.page_range %}
|
||||
{% ifequal pNum p_entries_list.number %}
|
||||
{{ pNum }}
|
||||
{% else %}
|
||||
<a href="?page={{ pNum }}">{{ pNum }}</a>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
|
||||
|
|
||||
{% if p_entries_list.has_next %}
|
||||
<a href="?page={{ p_entries_list.next_page_number }}">İleri</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -88,8 +88,7 @@
|
|||
|
||||
{% if q_text %}
|
||||
İçinde <b>{{ q_text|truncatewords:8 }}</b> geçen girdiler
|
||||
{% endif %}
|
||||
.</p>
|
||||
{% endif %}.</p>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
{% autoescape off %}
|
||||
|
||||
{% ifequal entry.entry_id.is_approved 1 %}
|
||||
|
||||
|
||||
{% ifchanged entry.date.day entry.date.month entry.date.year %}<div class="separator"></div>{% endifchanged %}
|
||||
|
||||
{% ifchanged %}<h2 class="date">{{ entry.date|date:"d F Y" }}</h2>{% endifchanged %}
|
||||
|
||||
<div class="innercontent">
|
||||
|
||||
<a href="{{ entry.entry_id.channel_link }}" title="{{ entry.entry_id.channel_title }}"><img class="face" src="/djagenmedia/images/heads/{{ entry.entry_id.author_face|default:"nobody.png" }}" title="{{ entry.entry_id.author_name }}" width="80" height="80" /></a>
|
||||
<a href="{{ entry.entry_id.channel_link }}" title="{{ entry.entry_id.channel_title }}"><img class="face" src="/djagenmedia/images/heads/{{ entry.entry_id.author_face|default:"nobody.png" }}" title="{{ entry.entry_id.author_name }} {{ entry.entry_id.author_surname }}" width="80" height="80" /></a>
|
||||
<h1 class="title"><a href="{{ entry.link }} ">{{ entry.title }}</a></h1>
|
||||
<p class="yazaneden">
|
||||
Yazar: <a href="{{ entry.entry_id.channel_link }}" title="{{ entry.entry_id.channel_title }}">{{ entry.entry_id.author_name }}</a>
|
||||
Yazar: <a href="{{ entry.entry_id.channel_link }}" title="{{ entry.entry_id.channel_title }}">{{ entry.entry_id.author_name }} {{ entry.entry_id.author_surname }}</a>
|
||||
Tarih: <span class="blogdate">{{ entry.date|date:"d F Y H:i" }}</span>
|
||||
</p>
|
||||
<div class="blogcontent">
|
||||
|
@ -27,7 +27,7 @@
|
|||
{% endautoescape %}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
|
|
@ -1,11 +1,30 @@
|
|||
{% extends "main/base.html" %}
|
||||
{% block body %}
|
||||
<form action='{{ BASE_URL }}/archive ' method='GET'>
|
||||
<b>Yazar<br> Adı:</b><input type="text" name="q_author_name">
|
||||
{% comment %}
|
||||
<form action='{{ BASE_URL }}/archive ' method='GET'>
|
||||
<b>Yazar<br> Adı:</b><input type="text" name="q_author_name">
|
||||
ve/veya
|
||||
<b>Soyadı:</b><input type="text" name="q_author_surname"><br>
|
||||
veya<br>
|
||||
<b>Aradığınız Metin:</b><input type="text" name="q_text">
|
||||
<input type="submit" value="Listele">
|
||||
</form>
|
||||
<b>Aradığınız Metin:</b><input type="text" name="q_text">
|
||||
<input type="submit" value="Listele">
|
||||
</form>
|
||||
{% endcomment %}
|
||||
|
||||
<form action="{{ BASE_URL }}/archive" method="GET" enctype="multipart/form-data">
|
||||
{% for field in q_form %}
|
||||
<div class="fieldWrapper">
|
||||
{% if field.errors %}
|
||||
<span class="error">{{ field.errors }}</span>
|
||||
{% endif %}
|
||||
{{ field.label_tag }}
|
||||
{% if field.help_text %}
|
||||
<span class="small">{{ field.help_text }}</span>
|
||||
{% endif %}
|
||||
{{ field }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="spacer"></div>
|
||||
<input type="submit" value="Listele" />
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user