1

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)?

3
  • Can you give an example what is rendered (show source), and what you expect to be rendered? Edit: I use the Django template system a lot for dynamic values for inline javascript and inline css Commented Aug 18, 2016 at 12:28
  • I am just showing a template. the code i mentioned in question is showing page count @ bottom-right of page when i convert the template to pdf. It works perfectly except when trying to add some dynamic value from context variable passed to django template :( Commented Aug 18, 2016 at 12:48
  • @het.oosten specified css code is placed in internal css(and not inline). have you worked on internal css (or css using javascript) from context passed to django template? Commented Aug 23, 2016 at 7:15

1 Answer 1

1

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)
         }
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.