devlin31
devlin31

Reputation: 81

use context variable in internal css of django template

I am trying to add a value in page footer from value of context variable in django template.

I have added following code in internal css of django template.

@page{
@bottom-right {
   content: "Invoice No :- " {{ obj.property }} "Page No." counter(page) "/" counter(pages)
 }
}

Above code does not work after using {{ obj.property }} Since i think django template does not allow to change internal css with context variables.

I also referred this question.

Is there any way to do this in css or in combination with jquery(or js)?

Upvotes: 1

Views: 1465

Answers (1)

devlin31
devlin31

Reputation: 81

I found the answer. My syntax was not proper while showing data.

I just added '' around {{ object.property }} and it is working fine.

So my new code is simply.

        @page{
        @bottom-right {
           content: "Invoice No :- " '{{ obj.property }}' " Page No." counter(page) "/" counter(pages)
         }
    }

Upvotes: 1

Related Questions