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

According to this article Silverlight 2 Beta 2 supports the DataContractJsonSerializer object. But, when
This article gives a good overview on why structured exception handling is bad. Is
This article describes a way, in C#, to allow the addition of arbitrary value
This article here suggests to use -XX:+UseParNewGC To enable a parallel young generation GC
This article states that If your site is run on a shared Web server,
Taking this article on classes and structs as an example: http://msdn.microsoft.com/en-us/library/ms173109.aspx namespace ProgrammingGuide {
I came across this article written by Andrei Alexandrescu and Petru Marginean many years
I was reading this article about Double-Checked locking and out of the main topic
I read in this article that a company has created a software capable of
LearnWPF.com posted this article about converting bitmap images to XAML and using them in

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.