These are chat archives for django/django

27th
Jan 2018
emihir0
@emihir0
Jan 27 2018 00:01
I'm sure ppl would love to help you, but you must show at least some appropriate effort... show that you have researched your problem (e.g. django documentation), properly format your question... make it easy for people to follow basically
downloading a random file is usually a big no-no on any programming 'help' forum/chat
and especially when gitter allows for a very nice inchat formatting, e.g.:
class MyModel(models.Model):
    my_field = models.IntegerField()
Sanjeev Sharma
@thesanjeevsharma
Jan 27 2018 17:01
{% for admin in admins %}
<td>{{ admin['name'] }}</td>
{% endfor %}
I am trying to do this... but this gives me an error "couldn't parse the remainder: admin['name']" .... any idea?

admins is a list which contains dictionaries.

emihir0
@emihir0
Jan 27 2018 17:58
admin.name
not admin['name']
Sanjeev Sharma
@thesanjeevsharma
Jan 27 2018 19:30
@emihir0 Thank you so much, You saved my internship. <3
emihir0
@emihir0
Jan 27 2018 19:33
np
if you have a list (instead of dict) and want to get, for example, first admin only, then you can admin.0 - so if your admin was a user and you wanted his username, you'd do admin.0.username (this syntax is weird but that's the way it is because brackets are not allowed)
Sanjeev Sharma
@thesanjeevsharma
Jan 27 2018 19:41
Thanks for the tip. will keep that in mind. I just joined gitter and I am in love with the community,