Code

Opened 7 years ago

Closed 7 years ago

#3799 closed (fixed)

Lorem ipsum template tag

Reported by: Sascha Peilicke Owned by: adrian
Component: Template system Version: master
Severity: Keywords: Lorem ipsum, Template, Debug mode
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Hello, everybody knows the "Lorem ipsum ..." text usually used to test templates. Wouldn't it be good to have a django built-in variable which displays this text. I have to test lots of templates and pasting this text in and deleting later is silly work. You could use it if you declare some blocks in your "base.html" and fill them with "Lorem ipsum" per Default, so that everybody can see how a template looks and works. I think it would be best if this placeholder is only displayed in DEBUG-mode.

here is an example of what i mean:

<body>

{%block content %}{{ placeholder }}{{% endblock %}

</body>

instead of

<body>

{%block content %}content goes here{{% endblock %}

</body>

Attachments (1)

lorem_ipsum.patch (10.4 KB) - added by SmileyChris 7 years ago.
with tests and docs

Download all attachments as: .zip

Change History (15)

comment:1 Changed 7 years ago by Gary Wilson <gary.wilson@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

FYI, there is a Lorem ipsum template tag posted on djangosnippets.org.

comment:2 Changed 7 years ago by adrian

  • Triage Stage changed from Design decision needed to Accepted

I love it!

Changed 7 years ago by SmileyChris

with tests and docs

comment:3 Changed 7 years ago by SmileyChris

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 7 years ago by SmileyChris

  • Has patch set

Sounded fun, so I did it. Doesn't currently do the "only displayed in DEBUG-mode." request, so push it back if this was part of accepted decision.

comment:5 Changed 7 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [4847]) Fixed #3799 -- Added Lorem template tag for generation of random latin content. Thanks to SmileyChris for the implementation.

comment:6 Changed 7 years ago by russellm

(In [4848]) Fixes #3799 -- Oops - ran last checkin from the wrong directory. Checked in the rest of the lorem templatetag implementation.

comment:7 Changed 7 years ago by anonymous

Still missing django.utils.lorem_ipsum

comment:8 Changed 7 years ago by Sascha Peilicke

Thanks everybody, exactly what I wanted

comment:9 follow-up: Changed 7 years ago by SmileyChris

  • Resolution fixed deleted
  • Status changed from closed to reopened

Doesn't look like django.utils.lorem_ipsum was checked in. Can a committer fix this please?

comment:10 Changed 7 years ago by adrian

I'd prefer this tag to be in django.contrib rather than being a built-in tag. It's nice, but it's not fundamentally necessary. I'll make that change.

comment:11 follow-up: Changed 7 years ago by adrian

Just an FYI for SmileyChris: In the attached patch, some of the functions in the lorem_ipsum.py module define variables whose names are the same as the functions themselves. Although it works, it's kinda sketchy, so I'm changing the internal variable names.

comment:12 in reply to: ↑ 9 Changed 7 years ago by russellm

Replying to SmileyChris:

Doesn't look like django.utils.lorem_ipsum was checked in. Can a committer fix this please?

Bother. I didn't have a good night with this ticket... :-)

It looks like Adrian is picking up the ball on this one. I'll leave him to it.

comment:13 in reply to: ↑ 11 Changed 7 years ago by SmileyChris

Replying to adrian:

... define variables whose names are the same as the functions themselves. Although it works, it's kinda sketchy...

Thanks, I'll avoid that in the future.

comment:14 Changed 7 years ago by adrian

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [4857]) Fixed #3799 -- Added django.contrib.webdesign and moved 'lorem' template tag into there

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.