# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-16 14:54
from __future__ import unicode_literals

from django.db import migrations

from nntpchan.frontend import util

def make_admin_key(apps, schema_editor):
    ModPriv = apps.get_model("frontend", "ModPriv")
    sk, pk = util.keygen()
    print("!!!!! YOUR ADMIN SECRET KEY IS {} !!!!!".format(sk))
    mod = ModPriv(level=0, pubkey=pk)
    mod.save()

class Migration(migrations.Migration):

    dependencies = [
        ('frontend', '0002_modpriv'),
    ]

    operations = [
        migrations.RunPython(make_admin_key)
    ]
