Галопом по Европам об основных фичах релиза Django 1.4. Обзорный доклад освещает самые "вкусные" новинки: поддержку таймзон, python 2.5+, улучшения по ORM, новую структуру проекта, шаблоны и многое другое.
Assignment-теги @register.assignment_tag def get_current_time(format_string): return datetime.datetime.now().strftime(format_string) {% get_current_time "%Y-‐%m-‐%d %I:%M %p" as the_time %} The time is {{ the_time }}.
Браузерное тестирование class AdminSeleniumWebDriverTestCase(LiveServerTestCase): ... class DateTimePickerSelenium(AdminSeleniumWebDriverTestCase): def test_show_hide_date_time_picker_widgets(self): self.admin_login(username='super', password='123') # Open a page that has a date and time picker widgets self.selenium.get('%s%s' % (self.live_server_url, '/admin_widgets/member/add/')) # Check that the date picker is hidden self.assertEqual( self.get_css_value('#calendarbox0', 'display'), 'none') # Click the calendar icon self.selenium.find_element_by_id('calendarlink0').click() # Check that the date picker is visible self.assertEqual( self.get_css_value('#calendarbox0', 'display'), 'block')