i write with this method, but nothing is displayed, only blank page,
On Friday, May 27, 2016 at 3:25:35 PM UTC+8, jorr...@gmail.com wrote:
-- however there are data shown in console
where is wrong?
{% block content %}
<table>
{% for post in posts %}
<tr>
<td>
post.project
</td>
<td>
post.company
</td>
</tr>
{% endfor %}
</table>
{% endblock %}
views.py
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(request, 'approval.html')
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/c4c6b525-d728-49b8-ad3a-ddb3dde40f37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment