Coder Social home page Coder Social logo

rails-inspire-django / django-turbo-helper Goto Github PK

View Code? Open in Web Editor NEW
78.0 8.0 4.0 613 KB

Hotwire/Turbo helpers for Django, inspired by Rails.

Home Page: https://django-turbo-helper.readthedocs.io

License: MIT License

Python 99.52% HTML 0.26% Makefile 0.22%
turbo hotwire django

django-turbo-helper's Introduction

django-turbo-helper's People

Contributors

avinashjoshi avatar c4ptaincrunch avatar chrisgrande avatar danjac avatar davidkell avatar michael-yin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-turbo-helper's Issues

Question about the future

Hello,

I see that you have switched from Hotwire to htmx in one of your personal projects.
Does it mean you won't update djanto-turbo-response anymore ot just decided to use the other tool ?

I know there's been a lot of noise in Basecamp etc. and I am worried about the the future of Hotwire.

What is your opinion on that ?

Thanks for your work on the project and all the Howtire Django stuff.

Duplicate saves in TurboCreateView

After debugging, we noticed that the form is saved twice in TurboCreateView.

Relevant source code:

# mixins.py
class TurboFormModelMixin(TurboFormMixin):

    object: Optional[Model]

    def form_valid(self, form: forms.Form) -> HttpResponse:
        """If the form is valid, save the associated model."""
        self.object = form.save()
        return super().form_valid(form)

# views.py

class TurboCreateView(TurboFormModelMixin, CreateView):
    ...

But the Django CreateView already uses the ModelFormMixin with:

def form_valid(self, form):
    """If the form is valid, save the associated model."""
    self.object = form.save()
    return super().form_valid(form)

The result is that form.save() is called twice.

I think the fix is:

class TurboCreateView(TurboFormMixin, CreateView):
    ...
```

Ditto `TurboUpdateView`. Thoughts?

XSS vulnerable

The code in renderers.py uses f-strings to template HTML with HTML-escaping incoming strings. This means user content being used in a response could be reflected and rendered in the browser.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.