Skip to main content

A small package to easily create components inside your templates without saving them in the templates folder.

Project description

Django Simple Components

Django Simple Components is a small package to easily create components inside your templates without saving them in the templates folder.

Quick start

  1. Install package from pypi:
pip install django-simple-components
  1. Add simple_components to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
    ...,
    "simple_components",
]
  1. Add simple_components to your template like this:
{% load simple_components %}

{% set_component "first_component" %}
    <div class="card">
        <h3>{{ title }}</h3>
        <p>{{ description }}</p>
    </div>
{% end_set_component %}

<div class="card-list">
    {% component "first_component" title="Hello world!" description="Some text..." %}
    {% component "first_component"
        title="Some lines"
        description="Other text..."
    %}

    {% with value="this text will be capitalized later" %}
        {% component "first_component" title=123 description=value|capfirst %}
    {% endwith %}
</div>
  1. Hooray! Everything is ready to use it.

Contributing

If you would like to suggest a new feature, you can create an issue on the GitHub repository for this project. If you'd like to contribute code, you can fork the repository and submit a pull request with your changes.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-simple-components-0.0.1.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

django_simple_components-0.0.1-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page