Skip to content
Browse files

working on improving date endings

  • Loading branch information...
1 parent 821f86d commit 6f01c573d3f786bf927d1bff4413c42906b9d797 @yourcelf committed Sep 15, 2010
Showing with 8 additions and 5 deletions.
  1. +2 −0 afg/models.py
  2. +6 −5 afg/views.py
View
2 afg/models.py
@@ -1,4 +1,5 @@
import re
+import json
import datetime
from django.db import models
@@ -100,6 +101,7 @@ def to_dict(self):
obj = {}
for field in self._meta.fields:
obj[field.name] = unicode(getattr(self, field.name))
+ obj['phrase_links'] = json.loads(self.phrase_links)
return obj
class Meta:
View
11 afg/views.py
@@ -5,7 +5,7 @@
import datetime
from collections import defaultdict
-from django.http import Http404, HttpResponse
+from django.http import Http404
from django.utils.safestring import mark_safe
from django.db import connection
from django.core import paginator
@@ -242,6 +242,7 @@ def search(request, about=False, api=False):
span = max(1, (end - start).days)
gap = max(1, int(span / 100)) # target 100 facets
sqs = sqs.date_facet(key, start, end - datetime.timedelta(seconds=1), 'day', gap)
+ #sqs = sqs.raw_params('f.%s_exact.facet.date.hardend': True})
# sorting
sort = request.GET.get('sort', '')
@@ -315,10 +316,10 @@ def search(request, about=False, api=False):
except (TypeError, ValueError):
pass
if vals:
- max_value = min(_iso_to_datetime(counts['dates'][key]['end']),
- DiaryEntryIndex.max_date)
- vals.append(max_value.strftime('%Y-%m-%d'))
- val_counts.append(0)
+ #max_value = min(_iso_to_datetime(counts['dates'][key]['end']),
+ # DiaryEntryIndex.max_date)
+ #vals.append(max_value.strftime('%Y-%m-%d'))
+ #val_counts.append(0)
choice = {
'type': 'date',
'counts': val_counts,

0 comments on commit 6f01c57

Please sign in to comment.
Something went wrong with that request. Please try again.