Blog Post Model (Django)

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ม.ค. 2025

ความคิดเห็น • 16

  • @ironheadmedia1625
    @ironheadmedia1625 3 ปีที่แล้ว

    Woow. Great man. I am just following your since a few hours but you are just great. There is nothing more to say.

  • @rgperegrinus
    @rgperegrinus 2 ปีที่แล้ว +2

    The below is a way to troubleshoot a potential error that may stop to continuation of the course. Mitch will address this in a future video of this playlist
    If you are using an newer version of Django (mine is 3.2.16) than the one presented in this tut and encounter this error:
    "SuspiciousFileOperation at /admin/blog/blogpost/add/
    Detected path traversal attempt"
    You can solve by using this snippet:
    from django.core.files.storage import default_storage
    import os
    def upload_location(instance, filename):
    base_path = 'blog'
    author_id = str(instance.author.id)
    title = str(instance.title)
    file_path = os.path.join(base_path, author_id, title, filename)
    return default_storage.path(file_path)

    • @aslp3390
      @aslp3390 ปีที่แล้ว

      thanks

  • @jikol9631
    @jikol9631 5 ปีที่แล้ว

    Your "preseave" receiver is very interesting, keep it up! forsenScoots :thump-up:

  • @souradipchandra5925
    @souradipchandra5925 4 ปีที่แล้ว +1

    Hi Mitch,
    First of all thank you for such a great content.
    I have one doubt regarding how can we use multiple images in a single Blog Post. I know some of the WYSIWYG editor like ckeditor or tinymce but I want to know other alternative ways of doing the same.
    Looking forward for your reply on this.

    • @lets_see_777
      @lets_see_777 4 ปีที่แล้ว

      i am looking for the same answer, if u find anything, pls let me know

    • @lets_see_777
      @lets_see_777 4 ปีที่แล้ว +1

      yeah found a workaround, probably not the best way, but just pass string as variable to template and use
      {{variable_name | safe}} for parse it as html
      you will have to hard code links of stylesheets or JS or images of this html page to static folder yourself

  • @seamusforever7081
    @seamusforever7081 4 ปีที่แล้ว

    Really helpful.

  • @vijaynani2168
    @vijaynani2168 4 ปีที่แล้ว

    i have followed the same steps and but i can't see the blog in my admin page and i have applied all the migrations and don't see any error while running the server

    • @abhijain5019
      @abhijain5019 4 ปีที่แล้ว

      Make sure...u have registered it in your admin.py

    • @charlestao7118
      @charlestao7118 4 ปีที่แล้ว

      same

  • @TomislavMiletic
    @TomislavMiletic 4 ปีที่แล้ว

    Great content, thank you! I am interested in joining your channel as a "Member", but please tell me first:
    is there a possibility of asking questions for tips and advice about django, in that plan?

  • @abhijain5019
    @abhijain5019 4 ปีที่แล้ว

    Sir....I m getting integrity error...Foreign key constraint failed

    • @AkshanshGusain
      @AkshanshGusain 4 ปีที่แล้ว

      Can you post the entire error? Then I might be able to help.

  • @karthiksama1414
    @karthiksama1414 4 ปีที่แล้ว

    my image file is not getting displayed.a bunch of numbers are getting instead.help me out .thanks.

  • @NishitGrylls
    @NishitGrylls 5 ปีที่แล้ว

    1st