Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
dyve committed May 20, 2021
1 parent 9379f6f commit 9a6d1ba
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 4.0.0 - In development

- Set `IconRenderer` as default renderer (#58).
- Defer evaluation of strings (#53).
- Stop using `mark_safe` (#57).
- Merge `extra-classes` (#55).
Expand Down
53 changes: 31 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
# django-icons

Icons for Django

[![CI](https://github.com/zostera/django-icons/workflows/CI/badge.svg?branch=main)](https://github.com/zostera/django-icons/actions?workflow=CI)
[![Coverage Status](https://coveralls.io/repos/github/zostera/django-icons/badge.svg?branch=main)](https://coveralls.io/github/zostera/django-icons?branch=main)
[![Latest PyPI version](https://img.shields.io/pypi/v/django-icons.svg)](https://pypi.python.org/pypi/django-icons)
[![Any color you like](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

## Why should I use this?
Icons for Django

- Define your icons in your settings, with defaults for name, title and other attributes.
- Generate icons using template tags.
- Supports Font Awesome, Material, Bootstrap 3 and images out of the box.
- Add other (custom) icon sets by subclassing a renderer.
- Supports Font Awesome, Material, Bootstrap 3 and images.
- Add other libraries and custom icon sets by subclassing IconRenderer.
- Available on pypi as [django-icons](https://pypi.python.org/pypi/django-icons)
- Tested against [currently supported Python/Django combinations](https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django).
- [Documentation on readthedocs.org](https://django-icons.readthedocs.io/en/latest/)
- [Bug tracker](http://github.com/zostera/django-icons/issues)

## How do I use this?
## Installation

Define an icon in your `settings.py`, for example like this:
Install using pip.

```shell
pip install django-icons
```

Define an icon in your `settings.py`.

```python
DJANGO_ICONS = {
Expand All @@ -25,67 +33,68 @@ DJANGO_ICONS = {
},
}
```
The basic usage in a Django template:

Render an icon in a Django template.

```djangotemplate
{% load icons %}
{% icon 'edit' %}
```

This will generate the FontAwesome 5 pencil icon in regular style:
This will generate the FontAwesome 5 pencil icon in regular style.

```html
<i class="far fa-pencil"></i>
```

Add extra classes and attributes to your predefined icon like this:
Add extra classes and attributes to your predefined icon.

```djangotemplate
{% load icons %}
{% icon 'edit' extra_classes='fa-fw my-own-icon' title='Update' %}
```

This will generate:
These will be added to the HTML output.

```html
<i class="far fa-pencil fa-fw my-own-icon" title="Update"></i>
```

## Requirements

This package requires a Python 3.6 or newer and Django 2.2 or newer.

The combination must be supported by the Django Project. See "Supported Versions" on <https://www.djangoproject.com/download/>.
This package requires a combination of Python and Django that is currently supported. See "Supported Versions" on <https://www.djangoproject.com/download/>.

## Local installation

Assuming Python>=3.6 is available on your system, the development dependencies are installed with Poetry as follows:
This section assumes you know about local Python versions and virtual environments.

To clone the repository and install the requirements for local development:

```shell script
```shell
$ git clone git://github.com/zostera/django-icons.git
$ cd django-icons
$ pip install -U pip -r requiremenets-dev.txt
$ pip install -U pip -r requirements-dev.txt
```

### Running the demo

You can run the example app:

```shell script
run python manage.py runserver
```shell
cd example && run python manage.py runserver
```

### Running the tests

The test suite requires [tox](https://tox.readthedocs.io/) to be installed. Run the complete test suite like this:

```shell script
```shell
tox
```

Test for the current (virtual) environment can be run with the Django `manage.py` command. If you need to do this, you will need to have an understanding of Python virtual environments. Explaining those is beyong the scope of this README.
Test for the current environment can be run with the Django `manage.py` command.

```shell script
```shell
python manage.py test
```

Expand Down

0 comments on commit 9a6d1ba

Please sign in to comment.