# Path: proso_mnemonics/models.py
# class Mnemonic(models.Model):
#     LANGUAGES = [(i, code) for i, (code, name) in enumerate(settings.LANGUAGES)]
#     LANGUAGES_REVERSE = dict((t[1], t[0]) for t in LANGUAGES)
# 
#     place = models.ForeignKey(Place)
#     text = models.TextField()
#     language = models.SmallIntegerField(choices=LANGUAGES, default=LANGUAGES[0][0])
# 
#     def to_serializable(self):
#         return {
#             'code': self.place.code,
#             'text': self.text,
#         }
# 
# Path: geography/models.py
# def migrate_google_user(email):


from django.core.management.base import BaseCommand
from proso_mnemonics.models import Mnemonic
from geography.models import Place
import csv
import settings
import os.path
# -*- coding: utf-8 -*-


class Command(BaseCommand):
    help = """Add new places"""

    def handle(self, *args, **options):
        for lang in settings.LANGUAGES:
            self.set_mnemonics(lang[0])

    def set_mnemonics(self, lang_code):
        mnemonics = self.get_mnemonics(lang_code)
        for code, text in mnemonics:
            try:
                place = Place.objects.get(code=code)

# Path: proso_mnemonics/models.py
# class Mnemonic(models.Model):
#     LANGUAGES = [(i, code) for i, (code, name) in enumerate(settings.LANGUAGES)]
#     LANGUAGES_REVERSE = dict((t[1], t[0]) for t in LANGUAGES)
# 
#     place = models.ForeignKey(Place)
#     text = models.TextField()
#     language = models.SmallIntegerField(choices=LANGUAGES, default=LANGUAGES[0][0])
# 
#     def to_serializable(self):
#         return {
#             'code': self.place.code,
#             'text': self.text,
#         }
# 
# Path: geography/models.py
# def migrate_google_user(email):


# Path: proso_mnemonics/management/commands/update_mnemonics.py
from django.core.management.base import BaseCommand
from proso_mnemonics.models import Mnemonic
from geography.models import Place
import csv
import settings
import os.path

# -*- coding: utf-8 -*-


class Command(BaseCommand):
    help = """Add new places"""

    def handle(self, *args, **options):
        for lang in settings.LANGUAGES:
            self.set_mnemonics(lang[0])

    def set_mnemonics(self, lang_code):
        mnemonics = self.get_mnemonics(lang_code)
        for code, text in mnemonics:
            try:
                place = Place.objects.get(code=code)

            except Place.DoesNotExist: