Re: Error while showing detailed post

2023-08-22 Thread Mvd Raghava
what issue are you facing. please send the error

On Sat, Aug 19, 2023 at 9:03 PM Dhiraj Kumar 
wrote:

> Hi new in Django,
>
> I want to display details post to the template but facing issue while
> trying to fetch post by id on the click of Continue Reading
> ,
> Views.py
>
> def show(request, id):
> print(id)
> try:
> showPost = post.objects.get(id=id)  # Assuming your model is
> named 'post'
> except post.DoesNotExist:
> # Handle the case where the post with the given ID doesn't exist
> raise Http404("Post does not exist")
>
> return render(request, 'show_post.html', {'showPost': showPost})
>
>
>
>
> Urls.py
> from django.urls import path
> from news import views
> from django.conf import settings
> from django.conf.urls.static import static
>
> urlpatterns = [
> path('',views.home, name='home' ),
> path('about', views.about, name="about"),
> path('contact', views.contact, name="contact"),
> path('News_post', views.News_post, name='News_post'),
> path('add_post',views.add_post,name='add_post'),
> path('show//', views.show, name='show')
>
> ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>
>
>
>
>
>
>
>
>
>
> Thanks & Regard Dhiraj Kumar
> Mobile No. : 9643843355, EXT: 250
> Email Id: dhi...@nimbusitsolutions.com
>
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAdfw9TdfFir%2BiFUyGxAhzWLdpDCtfSZr2ZPhi7DJrUauJUn-w%40mail.gmail.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFfOSBnje%3DqkUBaa8ZFrLLZ7Fme7-DWE-px1LpbT06b3yvmHKg%40mail.gmail.com.


Error while showing detailed post

2023-08-19 Thread Dhiraj Kumar
Hi new in Django,

I want to display details post to the template but facing issue while
trying to fetch post by id on the click of Continue Reading
,
Views.py

def show(request, id):
print(id)
try:
showPost = post.objects.get(id=id)  # Assuming your model is named
'post'
except post.DoesNotExist:
# Handle the case where the post with the given ID doesn't exist
raise Http404("Post does not exist")

return render(request, 'show_post.html', {'showPost': showPost})




Urls.py
from django.urls import path
from news import views
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
path('',views.home, name='home' ),
path('about', views.about, name="about"),
path('contact', views.contact, name="contact"),
path('News_post', views.News_post, name='News_post'),
path('add_post',views.add_post,name='add_post'),
path('show//', views.show, name='show')

]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)










Thanks & Regard Dhiraj Kumar
Mobile No. : 9643843355, EXT: 250
Email Id: dhi...@nimbusitsolutions.com

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAdfw9TdfFir%2BiFUyGxAhzWLdpDCtfSZr2ZPhi7DJrUauJUn-w%40mail.gmail.com.