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

  • Home
  • SEARCH
  • 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 3336932
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:11:39+00:00 2026-05-18T00:11:39+00:00

In this article Django templates like this {% for i in mylist %} <tr>

  • 0

In this article Django templates like this

{% for i in mylist %}
  <tr>
    <td>{{i.replist|join:"</td><td>" }}</td>
  </tr>
{% endfor %}

prints the list mylist which is an object. Can this be done in Mako? Thanks.

EDIT

class Rep(db.Model):
    author = db.UserProperty()
    replist = db.ListProperty(str)
    unique = db.ListProperty(str)
    date = db.DateTimeProperty(auto_now_add=True)

class MainPage(webapp.RequestHandler):
    def get(self):      
        user = users.get_current_user()
        greeting = None

        if user:
            greeting = ("Welcome, %s! (<a href=\"%s\">sign out</a>)" %
                         (user.nickname(), users.create_logout_url("/")))
        else:
            greeting = ("<a href=\"%s\">Sign in or register</a>." %
                        users.create_login_url("/"))

        L = []                                   
        s = self.request.get('sentence')           
        L.append(s)                              

        L = L[0].split('\r\n')     

        def f2(L):
            checked = []
            for e in L:
                if e not in checked:
                    checked.append(e)
            return checked

        Rep().replist = L                                   
        Rep().put()                              
        mylist = Rep().all().fetch(10)

        leng = len(mylist)
        T = type(mylist)
        self.response.out.write("Ttttt")
        print [i for i in mylist]       
        L2 = f2(L)
        x = len(L)
        y = len(L2)
        delta = x - y
        for i in range(delta):
             L2.append('')

         q = Rep().all()
         results = q.fetch(10)
        db.delete(results)



         template_values = {"s": s,
                           "L": L,
                           "L2": L2,
                           "x": x,
                           "y": y,
                           "greeting": greeting,
                           "mylist": mylist,
                           "leng": leng,
                           "T": T,
                           }

        path = os.path.join(os.path.dirname(__file__), 'main.mako')
        templ = Template(filename=path)
        self.response.out.write(templ.render(**template_values))  
  • 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-18T00:11:40+00:00Added an answer on May 18, 2026 at 12:11 am

    http://www.makotemplates.org/docs/syntax.html#syntax_control

    EDIT:
    I would suggest using an ordered list or named tuple instead of a dictionary so you can focus on your output instead of your data.

    % for entry in mylist:
        <tr>
            % for key, value in entry:
            <td>${value}</td>
            % endfor
        </tr>
    % endfor
    

    You can nest these if you need to output many <td>s. To do the join part, just use a nested loop.

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

Sidebar

Related Questions

This article on MSDN states that you can use as many try catch blocks
this article suggests you can use Color c = Color.decode(FF0096); however this understandably throws
This article says: Every prime number can be expressed as 30k±1 , 30k±7 ,
According this article , generic JPA DAO(Data Access Object) is a pretty nice pattern.
Reading this article http://support.microsoft.com/kb/813878 I have a question: Where can I get ipseccmd.exe for
I`m trying to upload files to Django with SWFUpload. Found this article Django with
In django, I'm trying to do something like this: # if form is valid
I have a situation like this: there are three Django models, let's call them
http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/ When it comes to extending the User model, the above article list two
This article on memory leaks emphasizes that having superfluous event listeners leads to memory

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.