## Установка
` pip install django_typograph `
В settings.py INSTALLED_APPS добавить
` django_typograph `
## Использование
Импортировать
` from django_typograph.fields import TypographyField `
Добавить поле в модель
_text = models.TextField()
text = TypographyField(source="_text")
Выполнить миграции
## Пример модели
from django.db import models
from django_typograph.fields import TypographyField
class TestModel(models.Model):
title = models.CharField(max_length=200, verbose_name='Название')
_text = models.TextField()
text = TypographyField(source='_text')
def __unicode__(self):
return self.title
class Meta:
verbose_name = 'TestModel'
## Доступные настройки у поля TypographyField
* source - Из какого поля брать исходный код для типографии
* engine - Использовать другой движок для типографии именно у этого поля
* options - настройки для указанного движка. Если движок не указан, то настройки все равно будут применены к текущим
## Настройка
Для тонкой настройки нужно переопределить AppCfg приложения
Создайте файл:
```project_root/project_name/apps/django_typograph.py```
Со след. содержимым
from django_typograph.apps import DjangoTypographConfig
class CustomTypographConfig(DjangoTypographConfig):
engines = {
'EMT': {
'path': 'django_typograph.engine.EMT.driver.typography',
'options': {},
},
'EMT_SAFE': {
'path': 'django_typograph.engine.EMT.driver.typography',
'options': {
'OptAlign.all': 'off',
'OptAlign.oa_oquote': 'off',
'OptAlign.oa_obracket_coma': 'off',
'OptAlign.layout': 'off',
'Text.paragraphs': 'off',
'Text.auto_links': 'off',
'Text.breakline': 'off',
'Text.no_repeat_words': 'off',
}
}
}
default_engine = "EMT"
## Старые записи
Присутствует management команда type_records. Вся ее суть в том, что она просто пересохраняет текущих контент моделей у которых прописано поле TypographyField
---
А теперь рисуем сову собственно.
Metadata
Release files for django_typograph 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_typograph-0.1.4.tar.gz | 33.5 kB | Without provenance | Details for django_typograph-0.1.4.tar.gz |
Release files / django_typograph-0.1.4.tar.gz
| Download URL | django_typograph-0.1.4.tar.gz |
|---|---|
| Size | 33.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5bf4f5c9d4c6be8cb9a499c552813ce2ea0fae5cb21e76dcb05cef545da09d9f
|
|
BLAKE2b-256 checksum How to use checksums |
97cc0b2247b737b833366c6fe02583dcfc11f80f5f7ff7fe3558c6920acdb20d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django_typograph 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.