示例#1
0
文件: models.py 项目: cjones/madcow
 def guid(self):
     """Global unique identifier for this object"""
     id = first([getattr(self, key, None) for key in ('publish_id', 'external_id', 'id')])
     date = first([getattr(self, key, None) for key in ('published', 'activation_date', 'created', 'modified')])
     date = tzdatetime.new(date).utc
     meta = type(self)._meta
     return 'tag:%s,%s:/%s/%s/%d/%d' % (current_site.domain, date.strftime('%Y-%m-%d'), meta.app_label,
                                        meta.object_name.lower(), id, date.unixtime)
示例#2
0
 def guid(self):
     """Global unique identifier for this object"""
     id = first([getattr(self, key, None) for key in ('publish_id', 'external_id', 'id')])
     date = first([getattr(self, key, None) for key in ('published', 'activation_date', 'created', 'modified')])
     date = tzdatetime.new(date).utc
     meta = type(self)._meta
     return 'tag:%s,%s:/%s/%s/%d/%d' % (current_site.domain, date.strftime('%Y-%m-%d'), meta.app_label,
                                        meta.object_name.lower(), id, date.unixtime)
示例#3
0
文件: models.py 项目: cjones/madcow
 def get_best_url(self):
     """The URL you should actually use, prefers final redirection page, if it exists"""
     return first(self.resolved_url, self.url)
示例#4
0
 def get_best_url(self):
     """The URL you should actually use, prefers final redirection page, if it exists"""
     return first(self.resolved_url, self.url)