{"repo":"adamghill/django-fbv","free":true,"listed":false,"github":"https://github.com/adamghill/django-fbv","clone":"git clone https://github.com/adamghill/django-fbv.git","description":"Utilities to make function-based views cleaner, more efficient, and better tasting.","language":"Python","stars":78,"topics":["django","function-based-views"],"license":"BSD-3-Clause","category":"saas-starters-boilerplates","readme_excerpt":"django-fbv 🕶️ Utilities to make Django function-based views cleaner, more efficient, and better tasting. 💥 📖 Complete documentation: https://django-fbv.adamghill.com Why? 🤔 The Django community has two ways to write views: class-based and function-based. One benefit of function-based views is that the HttpRequest input and the HttpResponse output is explicit, instead of being hidden within a hierarchy of classes and mixins. django-fbv reduces the boilerplate code required when using function-based views. It also leverages locality of behavior -- the name of the template is clearly associated to the view, instead of being part of the return statement. Instead of this: You can write this: Installation ⚙️ pip install django-fbv OR uv add django-fbv The decorators and views can be used by just importing them. The middleware needs to be installed. Features 🤩 Decorators - fbv.decorators.render html : renders a view as HTML with the specified template - fbv.decorators.render view : renders a view as a content type with the specified template - fbv.decorators.render json : renders dictionaries, Django Model , or Django QuerySet as a JSON response Views - fbv.views.html view : directly render a template from urls.py - fbv.views.redirect view : redirect to a pattern name from urls.py - fbv.views.file : serve a file - fbv.views.favicon file : serve an image file as the favicon.ico - fbv.views.favicon emoji : serve an emoji as the favicon.ico Middleware - fbv.middleware.RequestMetho","default_branch":null,"files":null,"tree":[],"storefront":"/r/adamghill","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/adamghill/django-fbv/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}