from django.core.management.base import (
    BaseCommand,
)

from apps.api.models import (
    Convention,
    Contest,
    Award,
    Contestant,
    Entrant,
    Session,
    Performance,
    Song,
    Singer,
    Director,
    Panelist,
)


class Command(BaseCommand):
    help = "Command to denormailze data."

    def handle(self, *args, **options):
        vs = Convention.objects.all()
        for v in vs:
            v.save()
        ts = Contest.objects.all()
        for t in ts:
            t.save()
        ps = Panelist.objects.all()
        for p in ps:
            p.save()
        ws = Award.objects.all()
        for w in ws:
            w.save()
        es = Entrant.objects.all()
        for e in es:
            e.save()
        cs = Contestant.objects.all()
        for c in cs:
            c.save()
        ss = Session.objects.all()
        for s in ss:
            s.save()
        as_ = Performance.objects.all()
        for a in as_:
            a.save()
        ps = Song.objects.all()
        for p in ps:
            p.save()
        ss = Singer.objects.all()
        for s in ss:
            s.save()
        js = Panelist.objects.all()
        for j in js:
            j.save()
        ds = Director.objects.all()
        for d in ds:
            d.save()
        return "Done"

@@ -122,55 +122,18 @@
     
-Award,%0A    Contestant,%0A    Entrant,%0A    Session
+Contestant
 ,%0A  
@@ -157,16 +157,27 @@
   Song,%0A
+    Group,%0A
     Sing
@@ -492,379 +492,72 @@
     
-ps = Panelist.objects.all()%0A        for p in ps:%0A            p.save()%0A        ws = Award.objects.all()%0A        for w in ws:%0A            w.save()%0A        es = Entrant.objects.all()%0A        for e in es:%0A            e.save()%0A        cs = Contestant.objects.all()%0A        for c in cs:%0A            c.save()%0A        ss = Session.objects.all()%0A        for s in ss:%0A            s
+cs = Contestant.objects.all()%0A        for c in cs:%0A            c
 .sav

Revert "Update denormalization command"