Note that there are some explanatory texts on larger screens.

plurals
  1. POUrl in a blog post django
    primarykey
    data
    text
    <p><a href="https://github.com/nathanborror/django-basic-apps/blob/master/README.rst" rel="nofollow">https://github.com/nathanborror/django-basic-apps/blob/master/README.rst</a> I am trying to implement this blog module my question is that the i am writing one generic function and when i fetch a blog get a url as</p> <pre><code>def Myfunc(request): p = Post.objects.get(pk=12) p.get_absolute_url //This prints blog/2011/jun/13/fgfgf/ </code></pre> <p>My question is that how to get the url with the domain name or where does this being handled in the code.. </p> <p><code>EDIT: i.e, <a href="http://mysite.com/blog/2011/jun/13/fgfgf/" rel="nofollow">http://mysite.com/blog/2011/jun/13/fgfgf/</a></code> </p> <p>The models field is as,</p> <pre><code> class Post(models.Model): """Post model.""" STATUS_CHOICES = ( (1, _('Draft')), (2, _('Public')), ) title = models.CharField(_('title'), max_length=200) slug = models.SlugField(_('slug'), unique_for_date='publish') author = models.ForeignKey(User, blank=True, null=True) body = models.TextField(_('body'), ) tease = models.TextField(_('tease'), blank=True, help_text=_('Concise text suggested. Does not appear in RSS feed.')) status = models.IntegerField(_('status'), choices=STATUS_CHOICES, default=2) allow_comments = models.BooleanField(_('allow comments'), default=True) publish = models.DateTimeField(_('publish'), default=datetime.datetime.now) created = models.DateTimeField(_('created'), auto_now_add=True) modified = models.DateTimeField(_('modified'), auto_now=True) categories = models.ManyToManyField(Category, blank=True) #created_by = models.ForeignKey(UserProfile) tags = TagField() objects = PublicManager() class Meta: verbose_name = _('post') verbose_name_plural = _('posts') db_table = 'blog_posts' ordering = ('-publish',) get_latest_by = 'publish' def __unicode__(self): return u'%s' % self.title @permalink def get_absolute_url(self): return ('blog_detail', None, { 'year': self.publish.year, 'month': self.publish.strftime('%b').lower(), 'day': self.publish.day, 'slug': self.slug }) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload