Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6610941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:54:18+00:00 2026-05-25T19:54:18+00:00

In a django template, is it possible to have two (or more) dots after

  • 0

In a django template, is it possible to have two (or more) dots after a variable? For example, say I have a list of objects that I first want to use a list-index lookup for and then once I have the object, I want to call its method for getting the absolute url, should that work?

For example:
    {% for entry in myList %}
    {{ entry.0.get_absolute_url }}
    {% endfor %}

So the 0 is asking for the first item in the list which is an object, then I want to get the absolute url. It doesn’t work when I try it but it doesn’t return an error either. Is there a better way to accomplish what I’m trying to do?

To clarify it, what’s strange is that:

This works:

{{ singleObject.get_absolute_url }}

In that case if I just try {{ singleObject }}, I get the unicode value of that object so something like: John Smith

This doesn’t work:

{% for object in objectList %}
{{ object.get_absolute_url }}
{% endfor %}

But in this case, if I put in {{ object }}, I no longer get the unicode value. I get: [<Name: John Smith>] (name being the name of the model)

Basically, the method works when it’s outside of a loop. Could there be any reason for that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:54:19+00:00Added an answer on May 25, 2026 at 7:54 pm

    I got it. I had brackets around each item in my list like so:

    objectList = [['John Smith'], ['Jim Jones'], ['Bill White']]
    

    Silly me! Thanks so much for your all your input

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django template that I want to extend in multiple places. In
Is it possible to create a django template that can be used (nested) inside
It is possible you have Javascript read vars from Django template tags like var
I know that it's possible to have a template filter return a SafeData instance
I have a basic question, in the Django template language how can you tell
I have some french letters (é, è, à...) in a django template but when
background: url({{ MEDIA_URL }}/bg.jpg); That does not work, because this Django template function only
I have a Django project for managing a list of journal articles. The main
Is it possible to have both frameworks available? So that I could have from
Is it possible to link specific templates for different flatpages in Django? For example:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.