Giter Club home page Giter Club logo

django-gesha's Introduction

django-gesha

Test Coverage Version Python Django

Documentation  •  Issue Tracker  •  Source


JavaScript utilities for Django projects.


Features:

  • Add context in Django views to be used in JavaScript functions.
  • Reverse URLs natively in JavaScript (equivalent to reverse() in Python and {% url %} in templates).
  • Written in TypeScript and fully-typed Python.

Getting started

To install and set up django-gesha in an existing Django project, see:

Starting a new Django project? Consider using django-gesha-template, which is pre-configured with django-gesha and a pipeline for TypeScript integration.

Contributing

See Contributing.

License

MIT.

django-gesha's People

Contributors

ely-as avatar

Stargazers

 avatar

Watchers

 avatar  avatar

django-gesha's Issues

Decide on how to provide API

Figure this out before publishing the first release candidate so there's no major changes to the API from then on.

Related to #12.

Want flexibility in delivery e.g.:

  1. can load the script in a template (either from collectstatic or from a CDN) and use it from there
    • and in this context, need to decide whether or not to add the API to window automatically (as is currently the case)
  2. can install via npm and import modules/build bundles

Also want flexibility in the project type e.g.:

  • TypeScript
  • CommonJS modules
  • ES modules

Serialize form objects

So we can handle form objects (and access their attributes e.g. errors, cleaned_data) from AJAX requests.

Add JS context using `super()` methods in class-based views

i.e. make this pattern possible:

class HomeView(..., TemplateView):
    def get_js_context_data(self, **kwargs):
        context = super().get_js_context_data(**kwargs)
        context["someString"] = "hi"
        return context
>> console.log(contextData.someString)
hi

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.