示例#1
0
文件: models.py 项目: paulcwatts/1hph
 def to_dict(self,request):
     json = { 'time': self.time,
             'description': self.description,
             'via': self.via,
             'url': request.build_absolute_uri(self.get_absolute_url()),
             'api_url': request.build_absolute_uri(self.get_api_url()),
             'photo_url': request.build_absolute_uri(self.photo.url),
             'thumbnail_url': request.build_absolute_uri(self.photo.url_240x180),
             'comments': request.build_absolute_uri(self.get_comments_url()) }
     if self.latitude:
         json['latitude'] = self.latitude
     if self.longitude:
         json['longitude'] = self.longitude
     json['source'] = utils.get_source_json(request, self)
     return json
示例#2
0
文件: models.py 项目: paulcwatts/1hph
 def to_dict(self, request):
     return { 'time': self.time,
              'submission': request.build_absolute_uri(self.submission.get_absolute_url()),
              'winner': utils.get_source_json(request, self),
              'name': self.get_value_display(),
              'points': self.points }
示例#3
0
文件: models.py 项目: paulcwatts/1hph
 def to_dict(self, request):
     return {
         'time': self.time,
         'source': utils.get_source_json(request, self),
         'text': self.text }