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)
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)