# -*- coding: utf-8 -*- from django.db import models from hvad.models import TranslatableModel, TranslatedFields # my models from directories.models import Iata class City(TranslatableModel): """ Create City model Uses hvad.TranslatableModel which is child of django.db.models class """ url = models.SlugField(unique=True) country = models.ForeignKey('country.Country', null=True) population = models.PositiveIntegerField(blank=True, null=True) phone_code = models.PositiveIntegerField(blank=True, null=True) code_IATA = models.ForeignKey(Iata, null=True) #translated fields translations = TranslatedFields( name = models.CharField(max_length=50), transport = models.TextField(blank=True), description = models.TextField(blank=True), famous_places = models.TextField(blank=True), shoping = models.TextField(blank=True), #-----meta title = models.CharField(max_length=255), descriptions = models.CharField(max_length=255), keywords = models.CharField(max_length=255), ) #fields saves information about creating and changing model created = models.DateTimeField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) def __unicode__(self): return self.lazy_translation_getter('name', self.pk)