Like in django you can implement the removal of posts on my blog?

I write the blog I want to implement delete posts through the form how can I do that?
July 12th 19 at 16:53
2 answers
July 12th 19 at 16:55
Solution
Not sure that's the best solution but will work.

  • Project - the project name
  • blog - the name of the app
  • Post the name of the model
  • is id advisable to use a slug
  • the link "delete" to hang on the button.

# views.py
from django.shortcuts import get_object_or_404
from django.core.urlresolvers import reverse

def delete(request, id):
 post = get_object_or_404(Post, id=id).delete() 
 return HttpResponseRedirect(reverse('blog.views.post'))


# urls.py
url(r'^delete/(?P<id>\d+)/$','project.blog.views.delete'),</id>
July 12th 19 at 16:57
What exactly does not work? You don't know how to do? The vyuha?
If in General: geom submit the form, post accept, if rest, the he. In the vyuha removed. What's the problem then?
Can you tutorial pass gange? There are:
www.tangowithdjango.com
https://stepic.org/course/Web-технологии-154
gen.lib.rus.ec/book/index.php?md5=C7E16835D8AC71A5...
www.intuit.ru/studies/courses/3586/828/info
Any way, such questions will disappear.

Find more questions by tags DjangoPython