diff --git a/pandora/annotation/models.py b/pandora/annotation/models.py index 461691e3..0c0380b1 100644 --- a/pandora/annotation/models.py +++ b/pandora/annotation/models.py @@ -108,8 +108,8 @@ class Annotation(models.Model): 'in': self.start, 'out': self.end, 'value': self.value, - 'created': self.created.strftime('%Y-%m-%dT%H:%M:%SZ'), - 'modified': self.modified.strftime('%Y-%m-%dT%H:%M:%SZ') + 'created': self.created, + 'modified': self.modified } def __unicode__(self): diff --git a/pandora/item/models.py b/pandora/item/models.py index bf299a1a..02719167 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -225,8 +225,18 @@ class Item(models.Model): self.update_find() self.update_sort() self.update_facets() + update_poster = False + if not settings.USE_IMDB: + if self.poster_frame == -1 and self.sort.duration: + self.poster_frame = self.sort.duration/2 + update_poster = True + if not self.get('runtime', None) and self.sort.duration: + self.data['runtime'] = self.sort.duration + self.update_sort() self.json = self.get_json() super(Item, self).save(*args, **kwargs) + if update_poster: + tasks.update_poster.delay(self.itemId) def delete(self, *args, **kwargs): self.delete_poster() @@ -258,40 +268,6 @@ class Item(models.Model): self.delete() other.save() - ''' - JSON cache related functions - ''' - #FIXME: this should not be used - _public_fields = { - 'itemId': 'id', - 'title': 'title', - 'year': 'year', - - 'runtime': 'runtime', - 'releasedate': 'releasedate', - - 'country': 'country', - 'director': 'director', - 'writer': 'writer', - 'editor': 'editor', - 'producer': 'producer', - 'cinematographer': 'cinematographer', - 'language': 'language', - 'genre': 'genre', - 'keyword': 'keyword', - 'cast': 'cast', - 'series_title': 'series_title', - 'episode_title': 'episode_title', - 'season': 'season', - 'episode': 'episode', - 'reviews': 'reviews', - 'trivia': 'trivia', - 'rating': 'rating', - 'votes': 'votes', - 'alternative_titles': 'alternative_titles', - 'connections_json': 'connections', - } - def get_poster(self): poster = {} poster['width'] = self.poster_width @@ -374,12 +350,6 @@ class Item(models.Model): if value: i[key] = value - #format datetime values -# #FIXME: do this in render_tojson - for key in i: - if isinstance(i[key], datetime): - i[key] = i[key].strftime('%Y-%m-%dT%H:%M:%SZ') - i['poster'] = self.get_poster() i['posters'] = self.get_posters() return i diff --git a/pandora/item/views.py b/pandora/item/views.py index 0c4fc7ae..648bb39d 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -206,8 +206,6 @@ Positions r[p] = m.sort.popularity else: r[p] = m.json.get(p, '') - if isinstance(r[p], datetime): - r[p] = r[p].strftime('%Y-%m-%dT%H:%M:%SZ') return r def only_p(m): r = {} diff --git a/pandora/place/models.py b/pandora/place/models.py index ca686120..99ea7e3f 100644 --- a/pandora/place/models.py +++ b/pandora/place/models.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 from __future__ import division, with_statement -from datetime import datetime from django.db import models import ox @@ -62,9 +61,6 @@ class Place(models.Model): 'south', 'west', 'north', 'east', 'lat', 'lng', 'size'): j[key] = getattr(self, key) - - if isinstance(j[key], datetime): - j[key] = j[key].strftime('%Y-%m-%dT%H:%M:%SZ') return j def save(self, *args, **kwargs):