Skip to content

Commit

Permalink
Merge pull request EGCETSII#54 from Villanueva-del-Trabuco-EGC/export…
Browse files Browse the repository at this point in the history
…acion-censo/dieruigil

[fix] Corrección fallo db
  • Loading branch information
TheNeoStormZ authored Dec 14, 2022
2 parents 2c7d410 + c3a82aa commit a2ff1d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
18 changes: 12 additions & 6 deletions decide/census/census_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@
from .models import Census

def get_user_atributes():
user = User.objects.all().values()[0]
atributes_list = []

counter = 0
for atribute in user.keys():
if not atribute == 'id' and not atribute == 'password':
atributes_list.append((counter, atribute))
counter += 1
if User.objects.all().values() != []:
user = User.objects.all().values()[0]
counter = 0
for atribute in user.keys():
if not atribute == 'id' and not atribute == 'password':
atributes_list.append((counter, atribute))
counter += 1

return atributes_list

# csvtext -> Header1,Header2,Header3/value1,value2,value3/value1,value2,value3/
def get_csvtext_and_data(form_values, census):
atributes_list = get_user_atributes()

if atributes_list == []:
atributes_list.append('id,username/None,NoUser')
return atributes_list

voters_data = []
headers = []

Expand Down
13 changes: 7 additions & 6 deletions decide/census/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
from django.contrib.auth.models import User

class AtributosUser(forms.Form):
user = User.objects.all().values()[0]
atributes_list = []

counter = 0
for atribute in user.keys():
if not atribute == 'id' and not atribute == 'password':
atributes_list.append((counter, atribute))
counter += 1
if User.objects.all().values() != []:
user = User.objects.all().values()[0]
counter = 0
for atribute in user.keys():
if not atribute == 'id' and not atribute == 'password':
atributes_list.append((counter, atribute))
counter += 1

user_atributes = forms.MultipleChoiceField(label="", choices=atributes_list, widget=forms.CheckboxSelectMultiple)

0 comments on commit a2ff1d0

Please sign in to comment.