Merge branch 'change-loop-to-len-statement' into 'master'
change for loop to a len() statement

See merge request !23
commit 81fe67d3b05846cb2aa9e4fc746dbaa8590bde6e
2 parents c2b031b + 745d366
@Abhilash Raj Abhilash Raj authored on 17 Sep 2015
Showing 1 changed file
View
8
src/postorius/views/user.py
try:
helperform = UserPreferences()
mm_user = MailmanUser.objects.get(address=request.user.email)
addresses = mm_user.addresses
i = 0
for address in addresses:
i = i + 1
AFormset = formset_factory(UserPreferences, extra=i)
AFormset = formset_factory(UserPreferences, extra=len(addresses._addresses))
formset = AFormset()
zipped_data = zip(formset.forms, addresses)
for form, address in zipped_data:
form.initial = address.preferences