Lorem ipsum django page

Published at 05, December 2008, author art. Tags: django, webdev

If you are a web designer, then sometimes you need to fill a web page with some fake text. In graphics and web design, lorem ipsum became a standart placeholder. This mean, that you need to have a handy source of this meaningless information :-)

Surely, you can use someone's lorem ipsum page, but I want to show how you can build your own in few minutes with django's generic view and simple template.

First of all, add this line to your urlpatterns:

(r'^lorem/$', 'django.views.generic.simple.direct_to_template', {'template': 'lorem.html'}),

Next, create template like this:

{% extends 'base.html' %}
{% load webdesign %}

{% block title %}{% block heading %}Lorem ipsum{% endblock %}{{ block.super }}{% endblock %}

{% block content %}
    {% lorem 5 p %}
{% endblock %}

As you can see, django doing all dirty work for us. We just load template tags for webdesign and then use tag lorem as text generator.

It need to say, that if you have enabled django-dbtemplates and flatpages, then you even don't need to modify the settings.py file or edit any local templates. In that case for can just add a flatpage with nondefault template.

Don't be slow, build your own lorem page right now! I already have one, and you?

Comments

Subscribe on this post's comments

No comments. Wanna be first?

First, identify yourself and come back to leave comments.

If you wish to leave comment, please, identify yourself and then come back to this page.