Django and HTMX #8 - Infinite Scroll and the hx-push-url attribute

Поделиться
HTML-код
  • Опубликовано: 22 окт 2024

Комментарии • 30

  • @MrBrunoPING
    @MrBrunoPING 2 года назад +3

    I was looking forward to the next video in the series!
    Thanks bro, I'm loving your HMTX content.

  • @lordAvatar
    @lordAvatar 2 года назад +2

    You're giving me homework? God damn it. Great series though, it should be way more popular.

  • @johnsolly
    @johnsolly 2 года назад +2

    Thank you for de-mystifying HTMX! I was able to follow along and implement this on my blog.

    • @bugbytes3923
      @bugbytes3923  2 года назад +1

      Glad to hear that! I’m happy the videos could help

  • @LegionLeague
    @LegionLeague 2 года назад +1

    You sir are amazing

  • @seydinaoumarsamabaly1806
    @seydinaoumarsamabaly1806 2 года назад +1

    GOD bless you man !!!

  • @samerelhamdo1104
    @samerelhamdo1104 2 года назад +2

    you see what happend if user refresh tha page or open the url in new tap ?

  • @swiftscroll
    @swiftscroll 2 года назад +1

    Perfect! Thanks a lot

  • @nevilleotieno9638
    @nevilleotieno9638 2 года назад +1

    Lovely tutorial. However, I do have one question, if you use hx-push-url which will update the URL, what would happen if the user refreshes the page? Wouldn't it reload the partial template which will be without the extended templates?

    • @iloveloam276
      @iloveloam276 2 года назад

      I've just come across this issue. If you refresh you will get a 404 in the video. In my case I had to add an optional slug parameter (slug=none) to my view and then add path"/sampleurl/ to my URLS to actually create a view for the refresh. If I hadn't done this /sampleurl/sampleslug is in the address bar but obviously there is no view for this.

  • @nicenaija9952
    @nicenaija9952 2 года назад +1

    I’ll like to see ajax post with a toast

  • @BeattapeFactory
    @BeattapeFactory 2 года назад +1

    thank you

    • @bugbytes3923
      @bugbytes3923  2 года назад

      You're welcome, thanks for commenting!

  • @mrmuranga
    @mrmuranga 2 года назад +1

    another great piece..thanks..are you able to share how you have setup your vscode..i like that vscdoe shows you as you code along when you last changed/committed the line/area you are working on..

    • @bugbytes3923
      @bugbytes3923  2 года назад

      Thanks again, I'm glad you are liking the videos.
      For that functionality, you can install the GitLens extension in VSCode. It's handy, especially when you're working in small teams!

  • @lordAvatar
    @lordAvatar 2 года назад +1

    The glitch at the end is actually 2 fold, maybe 3 fold. It loads all the film objects. And then it runs hx-get{% url 'film-list' %}?page=X at the end of that whole list. Which loads the films twice.
    My dumb ass solve was to load one object in films_partial and pass a true context:
    def films_partial(request):
    films = UserFilms.objects.filter(user=request.user)[0:1]
    context = {
    'films': films,
    'film_partial': True
    }

    return render(request, 'partials/film-list.html', context)
    Then modified film-list-elements.html to hide that newly generated element. Since it was the last element it automatically loaded as normal.
    {% if forloop.last %}
    {% else %}
    Now I wish i could return to the same location, could probably do it with JavaScript... of course why not just redirect to "films/" in views instead of doing all this? Again I'm learning maybe you can answer that?

  • @mohammadshafayethaydar1652
    @mohammadshafayethaydar1652 2 года назад

    Thank you this requested tutorial. Please please fix lost position when i go back to film list page from film detail page.

  • @repotranstech
    @repotranstech Год назад

    I have a question?what if you are using htmx requests in all your get requests?

  • @flutterVerseMyanmar
    @flutterVerseMyanmar 2 года назад

    There is bugs. paginate_by=10 but I addedd 5 movies in my list.Therefore forloop.last is True and when I click last movie, movie detail rendered under movie list. I don't know how to solve it

  • @ulugbeknurjonov5226
    @ulugbeknurjonov5226 2 года назад

    Can you show how make scroll with table html like total and subtotal ?

  • @creator4666
    @creator4666 Год назад

    Nc work

  • @yousefpahang
    @yousefpahang 2 года назад

    I'm using push-url with true and it does everything :
    hx-push-url="true"

  • @shavakano90
    @shavakano90 2 года назад

    what does your film.html file have?

    • @bugbytes3923
      @bugbytes3923  2 года назад

      You can find the templates on Github: github.com/bugbytes-io/django-htmx/tree/master/Video%20%238/films/templates

  • @johnmcway6120
    @johnmcway6120 Год назад

    You forgot to handle the last page. No get request needed for the last page.

  • @alimansimov1929
    @alimansimov1929 3 месяца назад

    3:36 (sorun buradan qaynaqlana biler)