django-vkontakte-iframe / vk_iframe / models.py

#coding: utf-8
from django.conf import settings
from django.db import models
from django.db.models import CharField, URLField, ForeignKey, NullBooleanField, IntegerField
from annoying.fields import AutoOneToOneField

try:
    from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
    from django.contrib.auth.models import User
else:
    User = get_user_model()


class Country(models.Model):
    title = CharField(u'Название', max_length=100, null=True, blank=True)

    def __unicode__(self):
        return self.title or u'[%s]' % self.pk

    class Meta:
        verbose_name = u'[vk] Страна'
        verbose_name_plural = u'[vk] Страны'
        ordering = ['id']


class City(models.Model):
    title = CharField(u'Название', max_length=100, null=True, blank=True)
    country = ForeignKey(Country, null=True, blank=True)

    def __unicode__(self):
        return self.title or u'[%s]' % self.pk

    class Meta:
        verbose_name = u'[vk] Город'
        verbose_name_plural = u'[vk] Города'
        ordering = ['id']


class Profile(models.Model):
    GENDER_CHOICES = (
        (2, u'Мужской',),
        (1, u'Женский',),
        (0, u'Без указания пола',),
    )
    user =          AutoOneToOneField(User, primary_key=True, related_name = 'vk_profile')
    nickname =      CharField(u'nick', max_length=100, blank=True, null=True)
    domain =        CharField(u'Адрес в url', max_length=50, blank=True, null=True)
    sex =           IntegerField(u'Пол', blank=True, null=True, choices = GENDER_CHOICES)
    bdate =         CharField(u'Дата рождения', max_length=10, blank=True, null=True)

    city =          ForeignKey(City, blank=True, null=True)
    country =       ForeignKey(Country, blank=True, null=True)
    timezone =      IntegerField(u'Часовой пояс', blank=True, null=True)

    photo =         URLField(blank=True, null=True)
    photo_medium =  URLField(blank=True, null=True)
    photo_big =     URLField(blank=True, null=True)
    photo_rec =     URLField(blank=True, null=True)

    rate =          IntegerField(u'Рейтинг', blank=True, null=True)
    has_mobile =    NullBooleanField(u'Есть сотовый', blank=True, null=True)
    home_phone =    CharField(u'Домашний телефон', max_length=30, blank=True, null=True)
    mobile_phone =  CharField(u'Сотовый телефон', max_length=30, blank=True, null=True)

    university =    IntegerField(u'Университет (id)', blank=True, null=True)
    university_name = CharField(u'Университет', max_length=50, blank=True, null=True)
    faculty =       IntegerField(u'Факультет (id)', blank=True, null=True)
    faculty_name =  CharField(u'Факультет', max_length=50, blank=True, null=True)
    graduation =    CharField(u'Год выпуска', max_length=4, blank=True, null=True)

    class Meta:
        verbose_name = u'[vk] Данные о пользователе'
        verbose_name_plural = u'[vk] Данные о пользователях'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.