Merge branch 'master' of github.com:bornhack/bornhack-website
This commit is contained in:
commit
3ef4094e94
|
@ -5,21 +5,7 @@ from __future__ import unicode_literals
|
|||
from django.db import migrations
|
||||
|
||||
def populate_team_responsible_public_credit_names(apps, schema_editor):
|
||||
Profile = apps.get_model("profiles", "Profile")
|
||||
TeamMember = apps.get_model("teams", "TeamMember")
|
||||
Team = apps.get_model("teams", "TeamMember")
|
||||
|
||||
for team in Team.objects.all():
|
||||
if TeamMember.objects.filter(team=team, responsible=True).exists():
|
||||
responsibles = User.objects.filter(teammember__team=team, teammember__responsible=True)
|
||||
else:
|
||||
responsibles = team.area.responsible.all()
|
||||
for resp in responsibles:
|
||||
if not resp.profile.public_credit_name:
|
||||
profile = resp.profile
|
||||
profile.public_credit_name = resp.profile.name
|
||||
profile.save()
|
||||
|
||||
pass
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
|
|
@ -18,3 +18,4 @@ class Migration(migrations.Migration):
|
|||
new_name='abstract',
|
||||
),
|
||||
]
|
||||
|
|
@ -8,7 +8,7 @@ from django.db import migrations, models
|
|||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('program', '0007_populate_public_credit_names_for_team_responsibles'),
|
||||
('program', '0007_auto_20160807_1333'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
|
Loading…
Reference in a new issue