Tutorials References Exercises Videos Menu
Free Website Get Certified Upgrade

Template Filter - ljust


Example

Write the name, justified to the left of a 20 characters field:

<h1>{{ name|ljust:20 }}.</h1>
Run Example »

Definition and Usage

The ljust filter places the value to the left in a field of the specified length.


Syntax

{{ value|ljust:length }}

Template filters are defined by using a pipe | character followed by the name of the filter.

Arguments are defined by using a colon : character followed by the argument value.


Arguments

Value Description
length Required. A number specifying the length of the field where the value will be left justified in.