parent
d26199cb70
commit
9562ffea97
|
@ -182,7 +182,7 @@ Use generic views: Less code is better
|
||||||
======================================
|
======================================
|
||||||
|
|
||||||
The ``detail()`` (from :doc:`Tutorial 3 </intro/tutorial03>`) and ``results()``
|
The ``detail()`` (from :doc:`Tutorial 3 </intro/tutorial03>`) and ``results()``
|
||||||
views are stupidly simple -- and, as mentioned above, redundant. The ``index()``
|
views are very simple -- and, as mentioned above, redundant. The ``index()``
|
||||||
view (also from Tutorial 3), which displays a list of polls, is similar.
|
view (also from Tutorial 3), which displays a list of polls, is similar.
|
||||||
|
|
||||||
These views represent a common case of basic Web development: getting data from
|
These views represent a common case of basic Web development: getting data from
|
||||||
|
|
|
@ -407,9 +407,7 @@ variables or to negate a given variable::
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if not athlete_list or coach_list %}
|
{% if not athlete_list or coach_list %}
|
||||||
There are no athletes or there are some coaches (OK, so
|
There are no athletes or there are some coaches.
|
||||||
writing English translations of boolean logic sounds
|
|
||||||
stupid; it's not our fault).
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if athlete_list and not coach_list %}
|
{% if athlete_list and not coach_list %}
|
||||||
|
|
|
@ -683,7 +683,7 @@ class GenericRelationTests(TestCase):
|
||||||
def test_prefetch_GFK(self):
|
def test_prefetch_GFK(self):
|
||||||
TaggedItem.objects.create(tag="awesome", content_object=self.book1)
|
TaggedItem.objects.create(tag="awesome", content_object=self.book1)
|
||||||
TaggedItem.objects.create(tag="great", content_object=self.reader1)
|
TaggedItem.objects.create(tag="great", content_object=self.reader1)
|
||||||
TaggedItem.objects.create(tag="stupid", content_object=self.book2)
|
TaggedItem.objects.create(tag="outstanding", content_object=self.book2)
|
||||||
TaggedItem.objects.create(tag="amazing", content_object=self.reader3)
|
TaggedItem.objects.create(tag="amazing", content_object=self.reader3)
|
||||||
|
|
||||||
# 1 for TaggedItem table, 1 for Book table, 1 for Reader table
|
# 1 for TaggedItem table, 1 for Book table, 1 for Reader table
|
||||||
|
|
|
@ -366,18 +366,18 @@ class TrailingSlashURLTests(TestCase):
|
||||||
If the value ends in more than one slash, presume they know what
|
If the value ends in more than one slash, presume they know what
|
||||||
they're doing.
|
they're doing.
|
||||||
"""
|
"""
|
||||||
self.settings_module.MEDIA_URL = '/stupid//'
|
self.settings_module.MEDIA_URL = '/wrong//'
|
||||||
self.assertEqual('/stupid//', self.settings_module.MEDIA_URL)
|
self.assertEqual('/wrong//', self.settings_module.MEDIA_URL)
|
||||||
|
|
||||||
self.settings_module.MEDIA_URL = 'http://media.foo.com/stupid//'
|
self.settings_module.MEDIA_URL = 'http://media.foo.com/wrong//'
|
||||||
self.assertEqual('http://media.foo.com/stupid//',
|
self.assertEqual('http://media.foo.com/wrong//',
|
||||||
self.settings_module.MEDIA_URL)
|
self.settings_module.MEDIA_URL)
|
||||||
|
|
||||||
self.settings_module.STATIC_URL = '/stupid//'
|
self.settings_module.STATIC_URL = '/wrong//'
|
||||||
self.assertEqual('/stupid//', self.settings_module.STATIC_URL)
|
self.assertEqual('/wrong//', self.settings_module.STATIC_URL)
|
||||||
|
|
||||||
self.settings_module.STATIC_URL = 'http://static.foo.com/stupid//'
|
self.settings_module.STATIC_URL = 'http://static.foo.com/wrong//'
|
||||||
self.assertEqual('http://static.foo.com/stupid//',
|
self.assertEqual('http://static.foo.com/wrong//',
|
||||||
self.settings_module.STATIC_URL)
|
self.settings_module.STATIC_URL)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ class BaseStaticFilesTestCase(object):
|
||||||
self._nonascii_filepath = os.path.join(self.testfiles_path, '\u2297.txt')
|
self._nonascii_filepath = os.path.join(self.testfiles_path, '\u2297.txt')
|
||||||
with codecs.open(self._nonascii_filepath, 'w', 'utf-8') as f:
|
with codecs.open(self._nonascii_filepath, 'w', 'utf-8') as f:
|
||||||
f.write("\u2297 in the app dir")
|
f.write("\u2297 in the app dir")
|
||||||
# And also create the stupid hidden file to dwarf the setup.py's
|
# And also create the magic hidden file to trick the setup.py's
|
||||||
# package data handling.
|
# package data handling.
|
||||||
self._hidden_filepath = os.path.join(self.testfiles_path, '.hidden')
|
self._hidden_filepath = os.path.join(self.testfiles_path, '.hidden')
|
||||||
with codecs.open(self._hidden_filepath, 'w', 'utf-8') as f:
|
with codecs.open(self._hidden_filepath, 'w', 'utf-8') as f:
|
||||||
|
|
Loading…
Reference in New Issue