Friday, May 27, 2016

Re: with django, how to write a grdview or table to show information and add a button or link in each row for approval?

after changed to     return render(posts, 'approval.html')
got error
'list' object has no attribute 'META'

def post_detail(request):
    posts = []
    with open('/home/martin/Downloads/site1/site1/reg/newusers.csv', 'rb') as csvfile:
     reader = csv.DictReader(csvfile)
     for row in reader:
      if len(row['name'].strip()) > 0 and len(row['project'].strip()) > 0 and len(row['initial password'].strip()) > 0 and len(row['email address'].strip()) > 0 and len(row['company'].strip()) > 0 and len(row['userType'].strip()) > 0 and len(row['businessType'].strip()) > 0 and len(row['contact'].strip()) > 0 and len(row['name'].strip()) > 0:
       eachbracket = {'name' : row['name'].strip(), 'project' : row['project'].strip(), 'businessType' : row['businessType'].strip(), 'userType' : row['userType'].strip(), 'company' : row['company'].strip()}
       posts = posts + [eachbracket];
    print posts
    return render(posts, 'approval.html')


got error
'list' object has no attribute 'META'

On Friday, May 27, 2016 at 3:25:35 PM UTC+8, jorr...@gmail.com wrote:
Sounds like Formsets is what you are looking for.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b72e7250-63ed-46a6-867c-0a3849972cb0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment