I might allow Editor or Author roles the ability to Create and Edit up front but then only admin or staff for deletions, via backend, so it's harder and makes you answer "are you sure", and shows you what else you're also about to delete potentially...
Thanks bro. I hope you can make some videos about class-based view's method and attribute and explain the difference between get_queryset, get_object and get_context_data
I add this becouse I think noone want random user for deleteing and updating posts. Big thanks for your work Master ! {% if request.user.is_staff %} Update Delete {% endif %}
I wanna make a similar thing as this form but the ImageField is a ForeignKey to another model that uploads images, so when I create a post I can display all the images that are already in my db and choose one of them or I can upload a new one (means I contain the Image form from the image model in the same page) So the post model is not going to upload images by itself, instead it's gonna references the images of the Image model by the id just like any other ForeignKey field Can you make a video of how to do this if it's possible?
Hi guys. This is the solution if still interested. In your views.py file, go to post-detail function: form = CommentForm(request.POST or None) if request.method == "POST": if form.is_valid(): form.instance.user = request.user form.instance.post_id = post .id form.save() return redirect(reverse("post-detail", kwargs={ 'id': post.pk }))
Akshay, this is the solution if still interested. In your views.py file, go to post-detail function: form = CommentForm(request.POST or None) if request.method == "POST": if form.is_valid(): form.instance.user = request.user form.instance.post_id = post .id form.save() return redirect(reverse("post-detail", kwargs={ 'id': post.pk }))
great tutorial you are good please i want to build a website for my work i sell fashion goods , cloths , bags , shoes and lot more how can i build it can you do a tutorial on that or have you done it
@@AMC-throwaway there is a one more issue : users can update or delete each others posts. Unable to hide options (delete and update) for those users who are not the author of the post.
@@Shivam_Manswalia add update and delete between the {% if request.user.is_staff %} INSTRUCTION {%endif%}. it means that the user has to be and admin for see the links
19:13 When I press submit, this error occurs. IntegrityError at /create/ NOT NULL constraint failed: posts_post.author_id Help please! Edit- I solved it myself. If anyone faces the same error, contact me.
@@hdsmsmart learndjango.com/tutorials/django-best-practices-referencing-user-model Use get_user_model instead of creating new class Author in models.py
@@raghavbansal358 could you be more specific, so I remove Author class ? and in model.py change author field in Post like author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE) ??
@@raghavbansal358 because in class Author we create models.OneToOneField(User, on_delete=models.CASCADE) with User = get_user_model() , should it still work ?
sonho See the link I send of that reddit post. In comments, you will find out that person has put his code of models.py. He is also working on same project using these tutorials
great tutorial you are good please i want to build a website for my work i sell fashion goods , cloths , bags , shoes and lot more how can i build it can you do a tutorial on that or have you done it
Cannot believe this video is 2years old ,its so relevant to this time and very educative ...good job
Another great video - I've learnt an enormous amount that I am already using from this series!
I might allow Editor or Author roles the ability to Create and Edit up front but then only admin or staff for deletions, via backend, so it's harder and makes you answer "are you sure", and shows you what else you're also about to delete potentially...
I love this channel thank you
Thanks bro. I hope you can make some videos about class-based view's method and attribute and explain the difference between get_queryset, get_object and get_context_data
Thank you ❤️
thanks man, you are really good at what you are doing! Wish you the best!
I add this becouse I think noone want random user for deleteing and updating posts. Big thanks for your work Master !
{% if request.user.is_staff %}
Update
Delete
{% endif %}
Awesome content!
can you make a tutorial on connectings ads to django website
Thanks man, really good tutorial. The tinyMCE is not letting upload images, it just asks for a Source but doesn't open an explorer
use ckeditor
I wanna make a similar thing as this form but the ImageField is a ForeignKey to another model that uploads images, so when I create a post I can display all the images that are already in my db and choose one of them or I can upload a new one (means I contain the Image form from the image model in the same page)
So the post model is not going to upload images by itself, instead it's gonna references the images of the Image model by the id just like any other ForeignKey field
Can you make a video of how to do this if it's possible?
I am getting an error when I am updating the post it display on comment section but not update the post
I am facing the same Issue. If you find any solution Please share with me.
@@SumonAhmed7530 did you guys solved this issue as I am also facing it
Hi Guys. Any solution to this yet?
Hi guys. This is the solution if still interested. In your views.py file, go to post-detail function:
form = CommentForm(request.POST or None)
if request.method == "POST":
if form.is_valid():
form.instance.user = request.user
form.instance.post_id = post
.id
form.save()
return redirect(reverse("post-detail", kwargs={
'id': post.pk
}))
@@mayurg2661 This doesn't work for me
Thanks for the tutorial, but did I miss linking the Categories??? Or is it just unfinished?
If you are not going to allow others to create posts, then why would you not just us the Admin Panel to do all the CRUD ?
getting an error when I am updating the post it display on comment section but not update the post, kindly guide me where i might be going wrong
Akshay, this is the solution if still interested. In your views.py file, go to post-detail function:
form = CommentForm(request.POST or None)
if request.method == "POST":
if form.is_valid():
form.instance.user = request.user
form.instance.post_id = post
.id
form.save()
return redirect(reverse("post-detail", kwargs={
'id': post.pk
}))
Image is not upload to tinymce from my computer
even I am facing the same error. It only asks for a source bbut doesn';t open the file explorer. Also how to add youtube viewer/thumbnai/emded image
how the youtube ads embed in upload video.?
how to get that algorithm in django.>
great tutorial you are good please i want to build a website for my work i sell fashion goods , cloths , bags , shoes and lot more how can i build it can you do a tutorial on that or have you done it
he already done tutorials on ecommerce website you can follow that
While updating content it updates comment not content..can you please help ?
did you solve it?
@@Shivam_Manswalia did you solve it ?
Please full blog git clone tutorial. Thanks
If it was just the admin running the blog, could they simply create posts from /admin instead of making a post_create.html?
May be
plz sir make a video for django_comments_xtd
everytime i am trying to update my post it's adding ** asdfsd what the ** this in comments and nothing on post.
help please..
In the template you need to add the 'safe' filter to render the html. {{ post.content | safe }}
Currently trying to debug this issue as well, had it working before but now getting the same issue of each update being submitted as a comment
@@AMC-throwaway there is a one more issue : users can update or delete each others posts.
Unable to hide options (delete and update) for those users who are not the author of the post.
Hi Guys. Any solution to this yet?
@@Shivam_Manswalia add update and delete between the {% if request.user.is_staff %} INSTRUCTION {%endif%}. it means that the user has to be and admin for see the links
Hello, for updating a post, each update being submitted as a comment. Has anyone solve this issue?
I have the same issue. Did you solve the issue?
MultiValueDictKeyError at /
'email'
Request Method: POST
cant seem to submit the 4th post anyone know how to fix this?
Check syntax in blog/urls.py.
What is the solution for users so they can't update or delete each others pots.
That would be an admin's previliage. It can be done in the admin panel.
I tried to deploy it to pythonanywhere, but I'm stuck with operational error / no table named posts_post
perform python manage.py migrate --run-syncdb..it worked for me
Hell yeah.... Thank you very much bro. Your a hero
@@maheshroyals6534 Thank you Very much
Hello,
When I am Updating posts, It added to the comment section the post is not updating. How can I solve the issue?
Try reload the page... or ctrl+F5... sometimes, my cache bug and it's solve...
@@lucastavares4908 still not working
@@oogieboogie7028 did you solve it ?
Hi Guys. Any solution to this yet?
19:13 When I press submit, this error occurs.
IntegrityError at /create/
NOT NULL constraint failed: posts_post.author_id
Help please!
Edit- I solved it myself. If anyone faces the same error, contact me.
i got the same error, please help!
@@hdsmsmart learndjango.com/tutorials/django-best-practices-referencing-user-model
Use get_user_model instead of creating new class Author in models.py
@@raghavbansal358 could you be more specific, so I remove Author class ? and in model.py change author field in Post like author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE) ??
@@raghavbansal358 because in class Author we create models.OneToOneField(User, on_delete=models.CASCADE) with User = get_user_model() , should it still work ?
sonho See the link I send of that reddit post. In comments, you will find out that person has put his code of models.py. He is also working on same project using these tutorials
request.method == "POST" return False
need help
How are you going to handle user auth?
I won't be covering it in this tutorial series but you can follow this tutorial to show how you can add it -> ruclips.net/video/BiHSP6bTsrE/видео.html
there is a video on this channel about it
when i delete my all post will be deleted automatically how i solve it
The posts are tied to the author class with on_delete=modles.CASCADE
See: stackoverflow.com/questions/38388423/what-does-on-delete-do-on-django-models
need confirm deleting :D
generic views are better for update , deleting, creating. Much less code
Hello,
when I submit the form I am getting" No file chosen" although the image is uploaded. How can i fix this issue?
you must be missing or repeating something check your code.
plz sir make a video for django_comments_xtd
great tutorial you are good please i want to build a website for my work i sell fashion goods , cloths , bags , shoes and lot more how can i build it can you do a tutorial on that or have you done it
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd
plz sir make a video for django_comments_xtd