Welcome to django-real-content’s documentation!

Django real content is a collection of template tags to quickly show real content instead of misleading lorem ipsum. Useful to get a sense of real world content with fun local unicode characters.

Works on Python >= 2.7 (including Python >= 3.5) and Django >= 1.6.

You can view the source code for the project on Github.

Contents:

Usage

Load django-real-content in your template.

{% load drc %}

random title

show random title

{% drc_title %}

show random title using h3 html tag

{% drc_title 'h3' %}

show random title using span html tag and with additional css class

{% drc_title 'span' css_class='custom_css_class' %}

show random title using h3 html tag with additional css class and language explicitly set (if you don’t set language explicitly, tag will use language setting from your django project’s settings)

{% drc_title 'h3' css_class='custom_css_class' language='si' %}

random paragraphs

show 1 random paragraph

{% drc_paragraphs %}

show 3 random paragraphs

{% drc_paragraphs 3 %}

show 1 random paragraph with additional css class

{% drc_paragraphs css_class='custom_css_class' %}

show 3 random paragraphs with additional css class

{% drc_paragraphs 3 css_class='custom_css_class' %}

show 3 random paragraphs with additional css class and language explicitly set (if you don’t set language explicitly, tag will use language setting from your django project’s settings)

{% drc_paragraphs 3 css_class='custom_css_class' language='si' %}

random image

show random image from lorempixel.com

{% drc_image %}

show random image from lorempixel.com which dimensions are 420x360

{% drc_image 420 360 %}

show random image from lorempixel.com which dimensions are 420x360 in category “cats” and grayscale

{% drc_image 420 360 category='cats' gray=True %}

show random image from lorempixel.com which dimensions are 420x360 in category “cats”, grayscale and with additional css class

{% drc_image 420 360 category='sports' gray=True css_class='custom_css_class' %}

random number

show a random number (it’s minimum and maximum values are set in DRC_NUMBER_START and DRC_NUMBER_END settings)

{% drc_number %}

show a random number between 1 and 100

{% drc_number 1 100 %}

Advanced

Need more content?

Use management command drc_addcontent to collect titles and paragraphs from given url. If no language is provided, it will use the one given in settings.

python manage.py drc_addcontent -u http://www.24sata.hr/a-383985 -l hr

Bare in mind that not all pages are structured ideally so unfortunately some trash could end up in language files.

Contributing

Want to add more languages? Open an issue and I’ll do my best. Or use github’s push requests or you can even just e-mail them to me.

Want to remove a title or a paragraph from some language files? Open an issue or a push request.

Installation

You can get Django real content by using pip

pip install django-real-content

In your project’s settings file add real_content to your INSTALLED_APPS setting and DRC_LANGUAGE setting (if none is set, english will be used).

INSTALLED_APPS = (
    # ...
    'real_content',
)

DRC_LANGUAGE = 'hr'

Languages currently supported out of the box

  • cz, de, en, es, fr, gr, hr, it, nl, pl, rs, ru, si