Coder Social home page Coder Social logo

alotab / djangohtmx Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 10 KB

Welcome to the Django HTMX User Search Project! This is a simple, yet powerful Django application that leverages the power of HTMX to enable live search functionality for users in the database. The beauty of this project lies in its simplicity - it achieves its goal without writing a single line of JavaScript!

License: MIT License

Python 75.88% HTML 24.12%
django htmx-django python3

djangohtmx's Introduction

Django HTMX User Search Project

Welcome to the Django HTMX User Search Project! This is a simple, yet powerful Django application that leverages the power of HTMX to enable live search functionality for users in the database. The beauty of this project lies in its simplicity - it achieves its goal without writing a single line of JavaScript!

Overview

The project uses HTMX, a modern tool that allows you to access AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, without needing to write any JavaScript. This makes our code cleaner, easier to understand, and more maintainable.

In this project, we have a search feature that allows you to start typing in a search box, and it will immediately start showing the search results from the user database, updating as you type. All of this is done without needing to refresh the page or write complex JavaScript code.

Code Snippet

Here’s a glimpse of the HTML code that powers the frontend of this application:

<h3>
    <span class="htmx-indicator">
      ...
   </span>
</h3>

<form>
    {% csrf_token %}
    <input class="form-control" type="search"
           name="search" placeholder="Begin Typing To Search Users..."
           hx-get="/search/results/"
           hx-trigger="keyup changed, search"
           hx-target="#search-results"
           hx-indicator=".htmx-indicator">
</form>

<div id="search-results">
    {% include "sim/search_results.html" %}
</div>

Stay tuned for more updates and feel free to contribute to this project! Happy coding! πŸš€

djangohtmx's People

Contributors

alotab avatar

Watchers

 avatar

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.