Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add final 2018 changes #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added RegDataUpdated.xlsx
Binary file not shown.
82 changes: 82 additions & 0 deletions import_csv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import csv

from reg.models import Participant, Team
from django.utils.crypto import get_random_string

def get_pid():
allowed_chars = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"
pid_list = list()

while True:
pid = get_random_string(4,allowed_chars)
if pid not in pid_list:
pid_list.append(pid)
break
return pid

def main():
"""
Create teams and participants in the database, and link participants with
their respective teams.
"""

csv_file = "shortlist.csv"
team_count = 0
participant_count = 0


#Delete all existing teams and participants from the database.
Team.objects.all().delete()
Participant.objects.all().delete()

with open(csv_file) as f:
reader = csv.reader(f)
data = [row for row in reader]

for item in data:
if item[0]:
team_count += 1

t = Team.objects.create(
name=item[0].strip(),
)

no_of_p = int(item[1])
print(item[1])
participant_count += no_of_p

p1 = Participant.objects.create(
participant_id=get_pid(),
name=item[2].strip() + " " + item[3].strip(),
gender=item[4].strip(),
college=item[7].strip(),
email=item[5].strip(),
phone=str(item[6]),
team=t
)

p2 = Participant.objects.create(
participant_id=get_pid(),
name=item[8].strip() + " " +item[9].strip(),
gender=item[10].strip(),
college=item[13].strip(),
email=item[11].strip(),
phone=str(item[12]),
team=t
)

if no_of_p == 3:
p3 = Participant.objects.create(
participant_id=get_pid(),
name=item[14].strip() + " " +item[15].strip(),
gender=item[16].strip(),
college=item[19].strip(),
email=item[17].strip(),
phone=str(item[18]),
team=t
)

print("{} teams and {} participants imported.".format(team_count,
participant_count))

main()
2 changes: 2 additions & 0 deletions ingenius/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
url(r'^breakfast/?$','reg.views.breakfast',name='breakfast'),
url(r'^lunch/?$','reg.views.lunch',name='lunch'),
url(r'^dinner/?$','reg.views.dinner',name='dinner'),
url(r'^snacks_evening/?$','reg.views.snacks_evening',name='snacks_evening'),
url(r'^snacks_midnight/?$','reg.views.snacks_midnight',name='snacks_midnight'),
url(r'^check_in/?$','reg.views.check_in',name='check_in'),
url(r'^stats/?$','reg.views.stats',name='stats'),
url(r'^dashboard/?$','reg.views.dashboard',name='dashboard'),
Expand Down
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ingenius.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ingenius.settings.local")

from django.core.management import execute_from_command_line

Expand Down
2 changes: 1 addition & 1 deletion reg/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ParticipantAdmin(admin.ModelAdmin):
'gender', 'phone', 'email', 'college', 'github_url',
'linkedin_url']}),
('Event Information', {'fields': ['team', 'barcode', 'registered',
'paid', 'checked_in', 'had_lunch', 'had_dinner', 'had_breakfast',
'paid', 'checked_in', 'had_lunch', 'had_dinner', 'had_snacks_evening','had_snacks_midnight','had_breakfast',
'noc_submitted', 'recharge_possible']})
]
list_display = ('participant_id', 'name', 'team', 'phone', 'email', 'gender', 'paid')
Expand Down
6 changes: 6 additions & 0 deletions reg/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ class BreakfastForm(forms.Form):

class DinnerForm(forms.Form):
barcode = forms.CharField(max_length=50, required=True)

class SnacksEveningForm(forms.Form):
barcode = forms.CharField(max_length=50, required=True)

class SnacksMidnightForm(forms.Form):
barcode = forms.CharField(max_length=50, required=True)
19 changes: 19 additions & 0 deletions reg/migrations/0003_auto_20181101_1100.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('reg', '0002_auto_20151001_1958'),
]

operations = [
migrations.AlterField(
model_name='participant',
name='gender',
field=models.CharField(max_length=1),
),
]
24 changes: 24 additions & 0 deletions reg/migrations/0004_auto_20181101_1310.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('reg', '0003_auto_20181101_1100'),
]

operations = [
migrations.AlterField(
model_name='team',
name='domain',
field=models.CharField(max_length=10, blank=True, choices=[('hardware', 'Hardware'), ('iot', 'Internet of Things'), ('ml', 'Machine Learning'), ('mobile', 'Mobile'), ('web', 'Web'), ('zwibe', 'Zwibe')]),
),
migrations.AlterField(
model_name='team',
name='idea',
field=models.TextField(blank=True),
),
]
19 changes: 19 additions & 0 deletions reg/migrations/0005_auto_20181101_1415.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('reg', '0004_auto_20181101_1310'),
]

operations = [
migrations.AlterField(
model_name='participant',
name='noc_submitted',
field=models.NullBooleanField(default=True),
),
]
19 changes: 19 additions & 0 deletions reg/migrations/0006_auto_20181101_1439.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('reg', '0005_auto_20181101_1415'),
]

operations = [
migrations.AlterField(
model_name='participant',
name='noc_submitted',
field=models.NullBooleanField(),
),
]
19 changes: 19 additions & 0 deletions reg/migrations/0007_auto_20181101_1549.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('reg', '0006_auto_20181101_1439'),
]

operations = [
migrations.AlterField(
model_name='participant',
name='noc_submitted',
field=models.BooleanField(default=False),
),
]
19 changes: 19 additions & 0 deletions reg/migrations/0008_auto_20181101_1645.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('reg', '0007_auto_20181101_1549'),
]

operations = [
migrations.AlterField(
model_name='participant',
name='noc_submitted',
field=models.BooleanField(default=True),
),
]
24 changes: 24 additions & 0 deletions reg/migrations/0009_auto_20181101_1724.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('reg', '0008_auto_20181101_1645'),
]

operations = [
migrations.AddField(
model_name='participant',
name='had_snacks_evening',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='participant',
name='had_snacks_midnight',
field=models.BooleanField(default=False),
),
]
6 changes: 4 additions & 2 deletions reg/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Team(models.Model):
('zwibe', 'Zwibe')
)
name = models.CharField(max_length=50)
idea = models.TextField()
idea = models.TextField(blank=True)
domain = models.CharField(max_length=10, choices=DOMAIN_CHOICES, blank=True)
team_id = models.PositiveIntegerField(blank=True, null=True)

Expand Down Expand Up @@ -51,10 +51,12 @@ class Participant(models.Model):
registered = models.BooleanField(default=False)
checked_in = models.BooleanField(default=False)
paid = models.BooleanField(default=False)
noc_submitted = models.NullBooleanField(null=True)
noc_submitted = models.BooleanField(default=True)
had_lunch = models.BooleanField(default=False)
had_dinner = models.BooleanField(default=False)
had_breakfast = models.BooleanField(default=False)
had_snacks_evening = models.BooleanField(default=False)
had_snacks_midnight = models.BooleanField(default=False)

def __str__(self):
return self.name
Expand Down
Loading