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 №104. Как научить Алису рецептам дореволюционной кухни
moscowdjango
PRO
0
16
Moscow Python Meetup №104. Оптимизация сервиса АБ тестирования или как уйти от Django ORM к Fastapi query builder
moscowdjango
PRO
0
26
Moscow Python Meetup №104. CI/CD Pytest для тестирования качества данных здравоохр. в Великобритании
moscowdjango
PRO
0
17
Moscow Python Meetup №103. Станислав Коленский (Самозанятый, репетитор). Как учат программированию в школьный период и на сколько можно готовить кадры с подросткового возраста
moscowdjango
PRO
0
36
Moscow Python Meetup №103. Мария Рубаненко (Fintech AI / Tech lead DS). Суперсжатие на строках
moscowdjango
PRO
0
69
Moscow Python Meetup №103. Михаил Попов (Assigna Python Backend Developer). Vibe coding. Очевидные преимущества и непоправимые угрозы
moscowdjango
PRO
0
32
Moscow Python Meetup №102 Михаил Васильев (старший специалист по машинному обучению). Поиск аномалий в данных, алгоритмы KNN и LOF
moscowdjango
PRO
0
52
Пётр Андреев (МФТИ, лектор по курсу Advanced Python). Дебри Python или как работает повседневный Python: что происходит на самом деле
moscowdjango
PRO
0
52
Moscow Python Meetup №102. Дарья Шпак (RW TECH, Руководитель группы разработчиков). Как Python каждый день выпускает кота
moscowdjango
PRO
0
53
Other Decks in Programming
See All in Programming
Swift Updates - Learn Languages 2025
koher
2
490
AIを活用し、今後に備えるための技術知識 / Basic Knowledge to Utilize AI
kishida
22
5.8k
さようなら Date。 ようこそTemporal! 3年間先行利用して得られた知見の共有
8beeeaaat
3
1.5k
詳解!defer panic recover のしくみ / Understanding defer, panic, and recover
convto
0
240
Azure SRE Agentで運用は楽になるのか?
kkamegawa
0
2.4k
RDoc meets YARD
okuramasafumi
4
170
JSONataを使ってみよう Step Functionsが楽しくなる実践テクニック #devio2025
dafujii
1
540
スケールする組織の実現に向けた インナーソース育成術 - ISGT2025
teamlab
PRO
1
120
The Past, Present, and Future of Enterprise Java with ASF in the Middle
ivargrimstad
0
140
Navigating Dependency Injection with Metro
zacsweers
3
1k
Flutter with Dart MCP: All You Need - 박제창 2025 I/O Extended Busan
itsmedreamwalker
0
150
Deep Dive into Kotlin Flow
jmatsu
1
350
Featured
See All Featured
It's Worth the Effort
3n
187
28k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
Site-Speed That Sticks
csswizardry
10
820
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Raft: Consensus for Rubyists
vanstee
140
7.1k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Music & Morning Musume
bryan
46
6.8k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.1k
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/