Check the link before pattern in path function

On Fri 11 Jan, 2019, 4:43 PM tribhuvan kishor <[email protected]
wrote:

> URL
>  path('<int:year>/<slug:post>/',views.post_detail, name='post_detail'),
> VIEW
>
> def post_detail(request, year,  post):
>     post = get_object_or_404(Post, slug=post,
>                              status='published',
>                              publish__year=year,)
>
>      return render(request,
>               'blog/post/detail.html',
>               {'post': post})
>
>
> TEMPLATE
>
> {% extends "blog/base.html" %}
> {% block title %}{{ post.title }}{% endblock %}{% block content %}
> <h1>{{ post.title }}</h1>
> <p class="date">
> Published {{ post.publish }} by {{ post.author }}
> </p>
> {{ post.body|linebreaks }}
> {% endblock %}
>
> Canonical URL
>
>
> def get_absolute_url(self):
>     return reverse('blog:post_detail', args=[self.publish.year, self.slug]
>
>
> TEMplate DIrectory
> PROJECT/APP/template/blog/detail.html
> --
> regards
> Tribhuvan Kishor Bhaskar
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACiphSX2LQ-oL0OwktHhLqCFwqqPwVwFagCaGX2rNTiBdxOa%2BA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACiphSX2LQ-oL0OwktHhLqCFwqqPwVwFagCaGX2rNTiBdxOa%2BA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BC2Q80cu1L4BvXE9PX%2BF140hOhiX8ZVLBqJtjATpm%3DJEcACNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to