Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Что нового в Django 1.5
Search
Moscow Python Meetup
PRO
January 24, 2013
Programming
3
1.8k
Что нового в Django 1.5
Илья Барышев (Future Colors)
Краткий обзор новых фич готовящегося релиза и советы по переходу.
Moscow Python Meetup
PRO
January 24, 2013
Tweet
Share
More Decks by Moscow Python Meetup
See All by Moscow Python Meetup
Moscow Python Meetup №108. Воркшоп "Построение AI-агента: Говори с данными на языке бизнеса"
moscowdjango
PRO
0
31
Moscow Python Meetup №108. Gather. Inspire. Deliver.
moscowdjango
PRO
0
29
Moscow Python Meetup №107. Бесшовные релизы глазами разработчика: обновляем код Облака без API
moscowdjango
PRO
0
36
Moscow Python Meetup №107. Django Blue-Green Migrations
moscowdjango
PRO
0
29
Moscow Python Meetup №107. Суперсжатые полнотекстовые индексы
moscowdjango
PRO
0
49
Moscow Python Meetup №106. Евгений Блинов (The Mutating Company, Founder). Суперфункции
moscowdjango
PRO
0
110
Moscow Python Meetup №106. Валерий Карпузов (SmartFX, Team Lead). Пиши, сокращай — Code Golf на Python
moscowdjango
PRO
0
120
Moscow Python Meetup №106. Николай Казак (Технический лидер роботизации бизнес-процессов, МТС Финтех). RPA по-взрослому
moscowdjango
PRO
0
61
Moscow Python Meetup №105. Кирилл Гладких (ООО Штаб, Python разработчик). Как вайбкодить по-сениорски
moscowdjango
PRO
0
150
Other Decks in Programming
See All in Programming
The free-lunch guide to idea circularity
hollycummins
0
270
Linux Kernelの1文字のミスで 権限昇格ができた話
rqda
0
1.9k
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
280
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
150
AI 開発合宿を通して得た学び
niftycorp
PRO
0
150
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.4k
ふつうのRubyist、ちいさなデバイス、大きな一年 / Ordinary Rubyists, Tiny Devices, Big Year
chobishiba
1
480
Migration to Signals, Signal Forms, Resource API, and NgRx Signal Store @Angular Days 03/2026 Munich
manfredsteyer
PRO
0
100
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
600
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
200
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
1.1k
「接続」—パフォーマンスチューニングの最後の一手 〜点と点を結ぶ、その一瞬のために〜
kentaroutakeda
3
1.1k
Featured
See All Featured
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.7k
The Cult of Friendly URLs
andyhume
79
6.8k
How STYLIGHT went responsive
nonsquared
100
6k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
160
Navigating Team Friction
lara
192
16k
Mobile First: as difficult as doing things right
swwweet
225
10k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
290
Claude Code のすすめ
schroneko
67
220k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
150
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
GraphQLの誤解/rethinking-graphql
sonatard
75
11k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Transcript
None
10 месяцев разработки ~1700 коммитов Переезд на гитхаб ~550 closed
PR Чуточку статистики
https://docs.djangoproject.com/en/dev/releases/1.5/ Улучшена документация • CBV • Testing Tutorial (part 5)
• Reusable apps • Writing your first patch for Django
Custom User Model
# myapp.models.py class MyUser(AbstractUser): email
= EmailField(max_length=254, ...) favorite_pony = CharField(max_length=20) ... USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['favorite_pony'] Пример custom User model
Обращаемся к модели # settings.py AUTH_USER_MODEL = 'myapp.MyUser' # Django
1.4 from django.contrib.auth.models import User # Django 1.5 from django.contrib.auth import get_user_model User = get_user_model()
AbstractUser User username first_name last_name email
is_staff is_active date_joined USERNAME_FIELD REQUIRED_FIELDS get_absolute_url() get_full_name() get_short_name()
AbstractBaseUser AbstractUser User password last_login get_username() is_anonymous() is_authenticated() set_password(...) check_password(...)
set_unusable_password() has_usable_password()
AbstractBaseUser AbstractUser User PermissionsMixin get_group_permissions(…) get_all_permissions(…) has_perm(…) has_perms(…) has_module_perms(…) is_superuser
AbstractBaseUser AbstractUser User PermissionsMixin
Составные ключи index_together = [ ["pub_date",
"deadline"], ]
product.save( update_fields=['name'] ) Частичное сохранение моделей
poll = Poll.objects.all()[0] >> 1 query choice = poll.choice_set.all()[0] >>
1 query choice.poll is poll >> 0 queries Кэширование related моделей
Streaming responses # 1.4 response = HttpResponse(content=myiterator) # 1.5 response
= StreamingHttpResponse( streaming_content=myiterator) def iterator(): for x in range(1,11): yield "%s\n" % x time.sleep(1)
{% verbatim %} {% verbatim %} {% endverbatim
%} JQuery Template {{if morning}}Drink coffee.{{/if}}
https://github.com/chrisdickinson/plate <script type="text/javascript" src="plate.js"> var template = new plate.Template(
'Hello {{ world }}'); template.render({world: 'everyone'}, function(err, data) { console.log(data) });
{{ view.template_name }} Переменная {{ view }} body.html {{ view.my_attribute
}} Hey class MyView(TemplateView): template_name = 'body.html' my_attribute = 'Hey'
# Django 1.2 {% url viewname %} # Django 1.3
{% load url from future %} {% url 'viewname' %} # Django 1.5 {% url 'viewname' %}
https://github.com/futurecolors/django-future-url django-‐make-‐future-‐url.py -‐-‐dry-‐run
QuerySet.bulk_create() работает с SQLite3 Сигнал user_login_failed Приятные мелочи Стандартные 404
и 500 {% if 'someapp.someperm' in perms %} GeoDjango PostGIS 2.0 loaddata(ignorenonexistent=True) Получение ContentType для прокси-моделей django.utils.timezone.localtime view.resolver_match django logger печататает в консоль mod_wsgi auth handler True, False, Null в шаблонах
Python 3*
Версии Python Django 1.3 Python 2.4+ Django 1.4 Python 2.5+
Django 1.5 Python 2.6+ Python 3.2+
django.utils.six в Django 1.4.2+
# python 2 for k, v in mydict.iteritems(): # python
2 & 3 import six for k,v in six.iteritems(mydict):
# python 2.6 & 3 from __future__ import print_function
print('Hello world!', end=' ') # python 2 print 'Hello world!', # python 3 print('Hello world!', end=' ')
https://github.com/mitsuhiko/python-modernize Автоматизируем six
http://python3porting.com/
None
django Pillow django-model-utils django-picklefield embedly-python pytils django-storages docutils south requests
django-discover-runner mock django-nose psycopg2 dj-database-url 3 http://moscowdjango.ru/py3/
Пробуйте Django 1.5 @ Пишите на Python 3
Спасибо
[email protected]
@coagulant http://blog.futurecolors.ru/