coding utf-8 from django db import models from django contrib auth mod

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
new_fields = {
'blog': models.URLField(u'Блог', verify_exists=False, blank=True),
'country': models.CharField(u'Страна', max_length=20, db_index=True),
'city': models.CharField(u'Город', max_length=30, db_index=True),
'icq': models.CharField(u'ICQ', max_length=15, blank=True),
'jabber': models.CharField(u'Jabber', max_length=50, blank=True),
'msn': models.CharField(u'MSN', max_length=50, blank=True),
'ym': models.CharField(u'Yahoo Messenger', max_length=50, blank=True),
'public_email': models.CharField(u'Email', max_length=50, blank=True, help_text=u'Email, видимый для всех на странице профиля'),
'need_work': models.BooleanField(u'Нужна работа', blank=True, default=False, db_index=True),
'sites': models.ManyToManyField('DjangoSite', verbose_name=u'Сайты', blank=True, null=True)
}
for name, field in new_fields.iteritems():
User.add_to_class(name, field)
class DjangoSite(models.Model):
title = models.CharField(u'Название', max_length=100)
url = models.URLField(u'URL', verify_exists=False)