defining guid, permalink for feeds and site
In our website, for short urls we are using a different domain name..
So, get_absolute_url() in model methods uses django.core.urlresolvers.reserve() and thus returns the actual domain name
Till now we have been manually defining short urls in views like
permalink = settings.SPC['short_URL_root'] + str(submission.id) + '/' + \
str(revision.rev_id+1) + '/'
settings.SPC['short_url_root'] is short-url domain name
Since I feel this method inconsistent I would like to define a model method like below
from django.conf import settings
def permalink(self):
return settings.SPC['short_URL_root'] + '/%d/%s' %(self.entry.pk, self.rev_id+1)
Would it be a nice idea..
The whole point of defining such a model method helps me returning "item_guid" in feed syndication. something like this:
def item_guid(self, item):
return item.permalink()
Would it be a nice idea to define such a model method?
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home