Re: [Django] #811: [patch] IPv6 address field support

2009-12-19 Thread Django
#811: [patch] IPv6 address field support
-+--
  Reporter:  mattimust...@gmail.com  | Owner:  adrian
Status:  reopened| Milestone:
 Component:  Core framework  |   Version:  SVN   
Resolution:  |  Keywords:
 Stage:  Ready for checkin   | Has_patch:  1 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by darkpixel):

 * cc: darkpixel (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #12409: Syntax error in the documentation from r11921

2009-12-19 Thread Django
#12409: Syntax error in the documentation from r11921
+---
  Reporter:  Alex   | Owner:  nobody
Status:  new| Milestone:  1.2   
 Component:  Documentation  |   Version:  SVN   
Resolution: |  Keywords:
 Stage:  Ready for checkin  | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by Alex):

  * stage:  Unreviewed => Ready for checkin

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #12409: Syntax error in the documentation from r11921

2009-12-19 Thread Django
#12409: Syntax error in the documentation from r11921
+---
  Reporter:  Alex   | Owner:  nobody
Status:  new| Milestone:  1.2   
 Component:  Documentation  |   Version:  SVN   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by ramiro):

  * has_patch:  0 => 1

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #9590: CharField and TextField with blank=True, null=True saves u'' instead of null

2009-12-19 Thread Django
#9590: CharField and TextField with blank=True, null=True saves u'' instead of
null
---+
  Reporter:  romke | Owner:  nobody 
   
Status:  closed| Milestone: 
   
 Component:  Database layer (models, ORM)  |   Version:  1.0
   
Resolution:  wontfix   |  Keywords:  charfield, 
textfield, null
 Stage:  Unreviewed| Has_patch:  0  
   
Needs_docs:  0 |   Needs_tests:  0  
   
Needs_better_patch:  0 |  
---+
Changes (by mightyhal):

  * has_patch:  1 => 0
  * component:  Forms => Database layer (models, ORM)

Comment:

 I agree that it's pretty annoying that django forces '' for empty string
 fields, even when null=True, blank=True is set.  Following mtredinnick's
 suggestion (and some teeth grinding), here's how to subclass a CharField
 to make it store NULL:


 {{{
 from django.db import models

 class CharNullField(models.CharField):
 description = "CharField that stores NULL but returns ''"
 def to_python(self, value):
 if isinstance(value, models.CharField):
 return value
 if value==None:
 return ""
 else:
 return value
 def get_db_prep_value(self, value):
 if value=="":
 return None
 else:
 return value
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #12409: Syntax error in the documentation from r11921

2009-12-19 Thread Django
#12409: Syntax error in the documentation from r11921
+---
  Reporter:  Alex   | Owner:  nobody
Status:  new| Milestone:  1.2   
 Component:  Documentation  |   Version:  SVN   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by Alex):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Django] #12409: Syntax error in the documentation from r11921

2009-12-19 Thread Django
#12409: Syntax error in the documentation from r11921
---+
 Reporter:  Alex   |   Owner:  nobody
   Status:  new|   Milestone:  1.2   
Component:  Documentation  | Version:  SVN   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 {{{
 query = 'SELECT * FROM myapp_person WHERE last_name = %s', % lname
 }}}

 is in those docs, it's also a syntax error.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Changeset] r11921 - in django/trunk: django/db/models django/db/models/sql docs/topics/db tests/modeltests tests/modeltests/raw_query tests/modeltests/raw_query/fixtures

2009-12-19 Thread noreply
Author: jacob
Date: 2009-12-19 20:46:58 -0600 (Sat, 19 Dec 2009)
New Revision: 11921

Added:
   django/trunk/tests/modeltests/raw_query/
   django/trunk/tests/modeltests/raw_query/fixtures/
   django/trunk/tests/modeltests/raw_query/fixtures/initial_data.json
   django/trunk/tests/modeltests/raw_query/models.py
   django/trunk/tests/modeltests/raw_query/tests.py
Modified:
   django/trunk/django/db/models/manager.py
   django/trunk/django/db/models/query.py
   django/trunk/django/db/models/query_utils.py
   django/trunk/django/db/models/sql/query.py
   django/trunk/docs/topics/db/queries.txt
   django/trunk/docs/topics/db/sql.txt
Log:
Fixed #11863: added a `Model.objects.raw()` method for executing raw SQL 
queries and yield models.

See `docs/topics/db/raw.txt` for details.

Thanks to seanoc for getting the ball rolling, and to Russ for wrapping things 
up.

Modified: django/trunk/django/db/models/manager.py
===
--- django/trunk/django/db/models/manager.py2009-12-19 18:03:58 UTC (rev 
11920)
+++ django/trunk/django/db/models/manager.py2009-12-20 02:46:58 UTC (rev 
11921)
@@ -1,5 +1,5 @@
 import django.utils.copycompat as copy
-from django.db.models.query import QuerySet, EmptyQuerySet, insert_query
+from django.db.models.query import QuerySet, EmptyQuerySet, insert_query, 
RawQuerySet
 from django.db.models import signals
 from django.db.models.fields import FieldDoesNotExist
 
@@ -181,6 +181,9 @@
 def _update(self, values, **kwargs):
 return self.get_query_set()._update(values, **kwargs)
 
+def raw(self, query, params=None, *args, **kwargs):
+return RawQuerySet(model=self.model, query=query, params=params, 
*args, **kwargs)
+
 class ManagerDescriptor(object):
 # This class ensures managers aren't accessible via model instances.
 # For example, Poll.objects works, but poll_obj.objects raises 
AttributeError.

Modified: django/trunk/django/db/models/query.py
===
--- django/trunk/django/db/models/query.py  2009-12-19 18:03:58 UTC (rev 
11920)
+++ django/trunk/django/db/models/query.py  2009-12-20 02:46:58 UTC (rev 
11921)
@@ -5,7 +5,7 @@
 from django.db import connection, transaction, IntegrityError
 from django.db.models.aggregates import Aggregate
 from django.db.models.fields import DateField
-from django.db.models.query_utils import Q, select_related_descend, 
CollectedObjects, CyclicDependency, deferred_class_factory
+from django.db.models.query_utils import Q, select_related_descend, 
CollectedObjects, CyclicDependency, deferred_class_factory, InvalidQuery
 from django.db.models import signals, sql
 from django.utils.copycompat import deepcopy
 
@@ -287,7 +287,7 @@
 Returns a dictionary containing the calculations (aggregation)
 over the current queryset
 
-If args is present the expression is passed as a kwarg ussing
+If args is present the expression is passed as a kwarg using
 the Aggregate object's default alias.
 """
 for arg in args:
@@ -1107,7 +1107,90 @@
 if forced_managed:
 transaction.leave_transaction_management()
 
+class RawQuerySet(object):
+"""
+Provides an iterator which converts the results of raw SQL queries into
+annotated model instances.
+"""
+def __init__(self, query, model=None, query_obj=None, params=None, 
translations=None):
+self.model = model
+self.query = query_obj or sql.RawQuery(sql=query, 
connection=connection, params=params)
+self.params = params or ()
+self.translations = translations or {}
 
+def __iter__(self):
+for row in self.query:
+yield self.transform_results(row)
+
+def __repr__(self):
+return "" % (self.query.sql % self.params)
+
+@property
+def columns(self):
+"""
+A list of model field names in the order they'll appear in the
+query results.
+"""
+if not hasattr(self, '_columns'):
+self._columns = self.query.get_columns()
+
+# Adjust any column names which don't match field names
+for (query_name, model_name) in self.translations.items():
+try:
+index = self._columns.index(query_name)
+self._columns[index] = model_name
+except ValueError:
+# Ignore translations for non-existant column names
+pass
+
+return self._columns
+
+@property
+def model_fields(self):
+"""
+A dict mapping column names to model field names.
+"""
+if not hasattr(self, '_model_fields'):
+self._model_fields = {}
+for field in self.model._meta.fields:
+name, column = field.get_attname_column()
+self._model_fields[column] = name
+return self._model_fields

Re: [Django] #6587: remove django.templates __path__ hacking

2009-12-19 Thread Django
#6587: remove django.templates __path__ hacking
--+-
  Reporter:  oyvind   | Owner:  andrewbadr 
Status:  new  | Milestone:  1.2
 Component:  Template system  |   Version:  SVN
Resolution:   |  Keywords:  path hacking remove
 Stage:  Accepted | Has_patch:  1  
Needs_docs:  0|   Needs_tests:  0  
Needs_better_patch:  1|  
--+-
Comment (by andrewbadr):

 Oyvind, or anyone: how do I use the latest patch? What's up with the
 /dev/null stuff?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Django] #12408: test runner needs to reorder tests more explicitly

2009-12-19 Thread Django
#12408: test runner needs to reorder tests more explicitly
+---
 Reporter:  seble...@gmail.com  |   Owner:  nobody
   Status:  new |   Milestone:
Component:  Testing framework   | Version:  SVN   
 Keywords:  |   Stage:  Unreviewed
Has_patch:  1   |  
+---
 Right now the test runner partitions the tests into two bins, either the
 TestCase bin or the catch all bin.  The ordering of the catch all bin then
 depends on the order in which the tests are seen.  The problem is that
 TransactionTestCase tests sometimes write to the test database without
 cleaning up after itself and that can sometimes affect a doctest that runs
 right after it since the doctest doesn't flush the database before it
 runs. Granted, doctests leave themselves vulnerable to each other since
 they can modify the database and don't flush before or after they
 complete. I think adding a little more protection by specifying that
 doctests should run before TransactionTestCase tests would help a little
 for the case when people write TransactionTestCase tests that modify data
 that later doctests are not expecting.

 I suspect this won't be an issue once a resolution of #5624 is found.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Django] #12407: "call_command" is not documented

2009-12-19 Thread Django
#12407: "call_command" is not documented
---+
 Reporter:  UloPe  |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Documentation  | Version:  1.1   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 The ''call_command'' functionality for invoking management commands
 programmatically has no documentation.

 The only place in the official docs it's mentioned is in the 0.96 to 1.0
 porting guide (http://docs.djangoproject.com/en/dev/releases/1.0-porting-
 guide/)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Django] #12406: Model Meta ordering bug with manytomany field

2009-12-19 Thread Django
#12406: Model Meta ordering bug with manytomany field
---+
 Reporter:  pbzrpa |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Uncategorized  | Version:  1.1   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 There seems to be a problem with ordering in a model meta class when you
 have a manytomany field in the model. It sorts the queryset grouped by the
 manytomany field.

 Example:

 {{{
 class RelationType(models.Model):
 name = models.CharField(max_length = 30)
 editable = models.BooleanField(default=True)

 def __unicode__(self):
 return u'%s' % self.name

 class Relation(models.Model):
 code = models.CharField(max_length = 20, primary_key = True)
 relationtype = models.ManyToManyField(RelationType)
 short_name = models.CharField(max_length = 30)
 full_name = models.CharField(max_length = 100, null = True, blank =
 True)
 pref_comm = models.ForeignKey(RelationCommunicationType, verbose_name
 = 'Perferred Comm')

 def __unicode__(self):
 return u'%s' % self.short_name

 class Meta:
 ordering = ('short_name',)
 }}}

 When you do Relation.objects.all() it sorts according to the short name
 but in lists grouped by the manytomany field.

 So you would have a result like:

 {{{
 Short Name   |   Type
 ab   |   Sup
 abc  |   Sup
 bcd  |   Sup
 abcd |   Cust
 }}}

 instead of

 {{{
 Short Name   |   Type
 ab   |   Sup
 abc  |   Sup
 abcd |   Cust
 bcd  |   Sup
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Changeset] r11920 - in django/branches/soc2009/multidb: django/contrib/admin django/contrib/contenttypes django/core/management/commands django/db/backends/postgresql django/db/models docs/ref docs/t

2009-12-19 Thread noreply
Author: Alex
Date: 2009-12-19 12:03:58 -0600 (Sat, 19 Dec 2009)
New Revision: 11920

Added:
   django/branches/soc2009/multidb/tests/modeltests/fixtures_model_package/
   
django/branches/soc2009/multidb/tests/modeltests/fixtures_model_package/__init__.py
   
django/branches/soc2009/multidb/tests/modeltests/fixtures_model_package/fixtures/
   
django/branches/soc2009/multidb/tests/modeltests/fixtures_model_package/fixtures/fixture1.json
   
django/branches/soc2009/multidb/tests/modeltests/fixtures_model_package/fixtures/fixture2.json
   
django/branches/soc2009/multidb/tests/modeltests/fixtures_model_package/fixtures/fixture2.xml
   
django/branches/soc2009/multidb/tests/modeltests/fixtures_model_package/fixtures/initial_data.json
   
django/branches/soc2009/multidb/tests/modeltests/fixtures_model_package/models/
   
django/branches/soc2009/multidb/tests/modeltests/fixtures_model_package/models/__init__.py
Modified:
   django/branches/soc2009/multidb/django/contrib/admin/options.py
   django/branches/soc2009/multidb/django/contrib/contenttypes/views.py
   django/branches/soc2009/multidb/django/core/management/commands/loaddata.py
   django/branches/soc2009/multidb/django/db/backends/postgresql/creation.py
   django/branches/soc2009/multidb/django/db/models/query.py
   django/branches/soc2009/multidb/docs/ref/databases.txt
   django/branches/soc2009/multidb/docs/topics/auth.txt
   django/branches/soc2009/multidb/docs/topics/serialization.txt
   django/branches/soc2009/multidb/tests/modeltests/lookup/models.py
   django/branches/soc2009/multidb/tests/regressiontests/admin_views/models.py
   django/branches/soc2009/multidb/tests/regressiontests/admin_views/tests.py
   
django/branches/soc2009/multidb/tests/regressiontests/generic_inline_admin/tests.py
   django/branches/soc2009/multidb/tests/regressiontests/views/tests/defaults.py
Log:
[soc2009/multidb] Merged up to trunk r11917.

Modified: django/branches/soc2009/multidb/django/contrib/admin/options.py
===
--- django/branches/soc2009/multidb/django/contrib/admin/options.py 
2009-12-19 15:31:28 UTC (rev 11919)
+++ django/branches/soc2009/multidb/django/contrib/admin/options.py 
2009-12-19 18:03:58 UTC (rev 11920)
@@ -353,6 +353,13 @@
 defaults.update(kwargs)
 return modelform_factory(self.model, **defaults)
 
+def get_changelist(self, request, **kwargs):
+"""
+Returns the ChangeList class for use on the changelist page.
+"""
+from django.contrib.admin.views.main import ChangeList
+return ChangeList
+
 def get_changelist_form(self, request, **kwargs):
 """
 Returns a Form class for use in the Formset on the changelist page.
@@ -896,7 +903,7 @@
 @csrf_protect
 def changelist_view(self, request, extra_context=None):
 "The 'change list' admin view for this model."
-from django.contrib.admin.views.main import ChangeList, ERROR_FLAG
+from django.contrib.admin.views.main import ERROR_FLAG
 opts = self.model._meta
 app_label = opts.app_label
 if not self.has_change_permission(request, None):
@@ -913,6 +920,7 @@
 except ValueError:
 pass
 
+ChangeList = self.get_changelist(request)
 try:
 cl = ChangeList(request, self.model, list_display, 
self.list_display_links, self.list_filter,
 self.date_hierarchy, self.search_fields, 
self.list_select_related, self.list_per_page, self.list_editable, self)

Modified: django/branches/soc2009/multidb/django/contrib/contenttypes/views.py
===
--- django/branches/soc2009/multidb/django/contrib/contenttypes/views.py
2009-12-19 15:31:28 UTC (rev 11919)
+++ django/branches/soc2009/multidb/django/contrib/contenttypes/views.py
2009-12-19 18:03:58 UTC (rev 11920)
@@ -9,7 +9,7 @@
 try:
 content_type = ContentType.objects.get(pk=content_type_id)
 obj = content_type.get_object_for_this_type(pk=object_id)
-except ObjectDoesNotExist:
+except (ObjectDoesNotExist, ValueError):
 raise http.Http404("Content type %s object %s doesn't exist" % 
(content_type_id, object_id))
 try:
 absurl = obj.get_absolute_url()

Modified: 
django/branches/soc2009/multidb/django/core/management/commands/loaddata.py
===
--- django/branches/soc2009/multidb/django/core/management/commands/loaddata.py 
2009-12-19 15:31:28 UTC (rev 11919)
+++ django/branches/soc2009/multidb/django/core/management/commands/loaddata.py 
2009-12-19 18:03:58 UTC (rev 11920)
@@ -88,7 +88,17 @@
 if has_bz2:
 compression_types['bz2'] = bz2.BZ2File
 
-app_fixtures = [os.path.join(os.path.dirname(app.__file__), 
'fixtures') for app in get_apps()]
+app_module_paths = []
+for app in get_apps():

Re: [Django] #11068: Wrong language cod e for Norwegian (Bokmål)

2009-12-19 Thread Django
#11068: Wrong language code for Norwegian (Bokmål)
---+
  Reporter:  nfg   | Owner:  jezdez 

Status:  new   | Milestone: 

 Component:  Internationalization  |   Version:  SVN

Resolution:|  Keywords:  language_code 
norwegian
 Stage:  Fixed on a branch | Has_patch:  0  

Needs_docs:  0 |   Needs_tests:  0  

Needs_better_patch:  0 |  
---+
Changes (by jezdez):

  * owner:  garcia_marc => jezdez
  * status:  reopened => new

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #11637: [soc2009/i18n] Formats missing for most locales

2009-12-19 Thread Django
#11637: [soc2009/i18n] Formats missing for most locales
---+
  Reporter:  garcia_marc   | Owner:  jezdez 
Status:  assigned  | Milestone:  1.2
 Component:  Internationalization  |   Version:  SVN
Resolution:|  Keywords:  i18n-rf
 Stage:  Accepted  | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by jezdez):

  * keywords:  => i18n-rf
  * owner:  garcia_marc => jezdez
  * status:  new => assigned
  * milestone:  => 1.2

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Changeset] r11919 - in django/branches/releases/1.1.X: . django/contrib/contenttypes tests/regressiontests/views/tests

2009-12-19 Thread noreply
Author: lukeplant
Date: 2009-12-19 09:31:28 -0600 (Sat, 19 Dec 2009)
New Revision: 11919

Modified:
   django/branches/releases/1.1.X/
   django/branches/releases/1.1.X/django/contrib/contenttypes/views.py
   django/branches/releases/1.1.X/tests/regressiontests/views/tests/defaults.py
Log:
[1.1.X] Fixed #10927 - Content Types shortcut view throws 500s instead of 404s
  
Thanks to Jeremy Dunck/Alex Gaynor for the patch

Backport of r11917 from trunk



Property changes on: django/branches/releases/1.1.X
___
Name: svnmerge-integrated
   - 
/django/trunk:1-11500,11523,11527-11528,11531-11552,11554,11577,11579-11581,11588-11589,11591-11592,11596-11599,11601-11617,11619-11626,11628-11635,11637-11638,11643-11644,11648-11653,11656,11670,11678,11681,11684,11686,11688,11691,11693,11695,11697,11699,11701,11703,11705,11707,11714,11719,11732,11734,11740,11748,11751,11753,11756,11760,11800,11808,11815,11817,11822,11826,11833,11835,11837,11839,11841,11844,11857,11864,11878,11914
   + 
/django/trunk:1-11500,11523,11527-11528,11531-11552,11554,11577,11579-11581,11588-11589,11591-11592,11596-11599,11601-11617,11619-11626,11628-11635,11637-11638,11643-11644,11648-11653,11656,11670,11678,11681,11684,11686,11688,11691,11693,11695,11697,11699,11701,11703,11705,11707,11714,11719,11732,11734,11740,11748,11751,11753,11756,11760,11800,11808,11815,11817,11822,11826,11833,11835,11837,11839,11841,11844,11857,11864,11878,11914,11917

Modified: django/branches/releases/1.1.X/django/contrib/contenttypes/views.py
===
--- django/branches/releases/1.1.X/django/contrib/contenttypes/views.py 
2009-12-19 15:27:50 UTC (rev 11918)
+++ django/branches/releases/1.1.X/django/contrib/contenttypes/views.py 
2009-12-19 15:31:28 UTC (rev 11919)
@@ -9,7 +9,7 @@
 try:
 content_type = ContentType.objects.get(pk=content_type_id)
 obj = content_type.get_object_for_this_type(pk=object_id)
-except ObjectDoesNotExist:
+except (ObjectDoesNotExist, ValueError):
 raise http.Http404("Content type %s object %s doesn't exist" % 
(content_type_id, object_id))
 try:
 absurl = obj.get_absolute_url()

Modified: 
django/branches/releases/1.1.X/tests/regressiontests/views/tests/defaults.py
===
--- 
django/branches/releases/1.1.X/tests/regressiontests/views/tests/defaults.py
2009-12-19 15:27:50 UTC (rev 11918)
+++ 
django/branches/releases/1.1.X/tests/regressiontests/views/tests/defaults.py
2009-12-19 15:31:28 UTC (rev 11919)
@@ -10,8 +10,8 @@
 """Test django views in django/views/defaults.py"""
 fixtures = ['testdata.json']
 
-def test_shorcut_with_absolute_url(self):
-"Can view a shortcut an Author object that has with a get_absolute_url 
method"
+def test_shortcut_with_absolute_url(self):
+"Can view a shortcut for an Author object that has a get_absolute_url 
method"
 for obj in Author.objects.all():
 short_url = '/views/shortcut/%s/%s/' % 
(ContentType.objects.get_for_model(Author).id, obj.pk)
 response = self.client.get(short_url)
@@ -19,12 +19,34 @@
  status_code=302, target_status_code=404)
 
 def test_shortcut_no_absolute_url(self):
-"Shortcuts for an object that has with a get_absolute_url method 
raises 404"
+"Shortcuts for an object that has no get_absolute_url method raises 
404"
 for obj in Article.objects.all():
 short_url = '/views/shortcut/%s/%s/' % 
(ContentType.objects.get_for_model(Article).id, obj.pk)
 response = self.client.get(short_url)
 self.assertEquals(response.status_code, 404)
 
+def test_wrong_type_pk(self):
+short_url = '/views/shortcut/%s/%s/' % 
(ContentType.objects.get_for_model(Author).id, 'nobody/expects')
+response = self.client.get(short_url)
+self.assertEquals(response.status_code, 404)
+
+def test_shortcut_bad_pk(self):
+short_url = '/views/shortcut/%s/%s/' % 
(ContentType.objects.get_for_model(Author).id, '4242424242')
+response = self.client.get(short_url)
+self.assertEquals(response.status_code, 404)
+
+def test_nonint_content_type(self):
+an_author = Author.objects.all()[0]
+short_url = '/views/shortcut/%s/%s/' % ('spam', an_author.pk)
+response = self.client.get(short_url)
+self.assertEquals(response.status_code, 404)
+
+def test_bad_content_type(self):
+an_author = Author.objects.all()[0]
+short_url = '/views/shortcut/%s/%s/' % (4242424242, an_author.pk)
+response = self.client.get(short_url)
+self.assertEquals(response.status_code, 404)
+
 def test_page_not_found(self):
 "A 404 status is returned by the page_not_found view"
 non_existing_urls = ['/views/non_existing_url/', 

[Changeset] r11918 - in django/branches/releases/1.1.X: . django/core/management/commands tests/modeltests tests/modeltests/fixtures_model_package tests/modeltests/fixtures_model_package/fixtures test

2009-12-19 Thread noreply
Author: lukeplant
Date: 2009-12-19 09:27:50 -0600 (Sat, 19 Dec 2009)
New Revision: 11918

Added:
   django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/__init__.py
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/fixtures/
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/fixtures/fixture1.json
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/fixtures/fixture2.json
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/fixtures/fixture2.xml
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/fixtures/initial_data.json
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/models/
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/models/__init__.py
Removed:
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/__init__.py
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/fixtures/
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/fixtures/fixture1.json
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/fixtures/fixture2.json
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/fixtures/fixture2.xml
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/fixtures/initial_data.json
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/models/
   
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/models/__init__.py
Modified:
   django/branches/releases/1.1.X/
   django/branches/releases/1.1.X/django/core/management/commands/loaddata.py
Log:
[1.1.X]  Fixed #6961 - loaddata fails if models is a package instead of a module
  
Thanks to pmd for report, zhaoz, mmalone and justinlilly for patch

Backport of 11914 from trunk.



Property changes on: django/branches/releases/1.1.X
___
Name: svnmerge-integrated
   - 
/django/trunk:1-11500,11523,11527-11528,11531-11552,11554,11577,11579-11581,11588-11589,11591-11592,11596-11599,11601-11617,11619-11626,11628-11635,11637-11638,11643-11644,11648-11653,11656,11670,11678,11681,11684,11686,11688,11691,11693,11695,11697,11699,11701,11703,11705,11707,11714,11719,11732,11734,11740,11748,11751,11753,11756,11760,11800,11808,11815,11817,11822,11826,11833,11835,11837,11839,11841,11844,11857,11864,11878
   + 
/django/trunk:1-11500,11523,11527-11528,11531-11552,11554,11577,11579-11581,11588-11589,11591-11592,11596-11599,11601-11617,11619-11626,11628-11635,11637-11638,11643-11644,11648-11653,11656,11670,11678,11681,11684,11686,11688,11691,11693,11695,11697,11699,11701,11703,11705,11707,11714,11719,11732,11734,11740,11748,11751,11753,11756,11760,11800,11808,11815,11817,11822,11826,11833,11835,11837,11839,11841,11844,11857,11864,11878,11914

Modified: 
django/branches/releases/1.1.X/django/core/management/commands/loaddata.py
===
--- django/branches/releases/1.1.X/django/core/management/commands/loaddata.py  
2009-12-19 15:25:16 UTC (rev 11917)
+++ django/branches/releases/1.1.X/django/core/management/commands/loaddata.py  
2009-12-19 15:27:50 UTC (rev 11918)
@@ -76,7 +76,17 @@
 if has_bz2:
 compression_types['bz2'] = bz2.BZ2File
 
-app_fixtures = [os.path.join(os.path.dirname(app.__file__), 
'fixtures') for app in get_apps()]
+app_module_paths = []
+for app in get_apps():
+if hasattr(app, '__path__'):
+# It's a 'models/' subpackage
+for path in app.__path__:
+app_module_paths.append(path)
+else:
+# It's a models.py module
+app_module_paths.append(app.__file__)
+
+app_fixtures = [os.path.join(os.path.dirname(path), 'fixtures') for 
path in app_module_paths]
 for fixture_label in fixture_labels:
 parts = fixture_label.split('.')
 

Copied: django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package 
(from rev 11914, django/trunk/tests/modeltests/fixtures_model_package)

Deleted: 
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/__init__.py
===
--- django/trunk/tests/modeltests/fixtures_model_package/__init__.py
2009-12-19 14:27:26 UTC (rev 11914)
+++ 
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/__init__.py
  2009-12-19 15:27:50 UTC (rev 11918)
@@ -1,2 +0,0 @@
-
-

Copied: 
django/branches/releases/1.1.X/tests/modeltests/fixtures_model_package/__init__.py
 (from rev 11914, 
django/trunk/tests/modeltests/fixtures_model_package/__init__.py)
===
--- 
django/branches/releas

[Changeset] r11917 - in django/trunk: django/contrib/contenttypes tests/regressiontests/views/tests

2009-12-19 Thread noreply
Author: lukeplant
Date: 2009-12-19 09:25:16 -0600 (Sat, 19 Dec 2009)
New Revision: 11917

Modified:
   django/trunk/django/contrib/contenttypes/views.py
   django/trunk/tests/regressiontests/views/tests/defaults.py
Log:
Fixed #10927 - Content Types shortcut view throws 500s instead of 404s

Thanks to Jeremy Dunck/Alex Gaynor for the patch



Modified: django/trunk/django/contrib/contenttypes/views.py
===
--- django/trunk/django/contrib/contenttypes/views.py   2009-12-19 15:02:46 UTC 
(rev 11916)
+++ django/trunk/django/contrib/contenttypes/views.py   2009-12-19 15:25:16 UTC 
(rev 11917)
@@ -9,7 +9,7 @@
 try:
 content_type = ContentType.objects.get(pk=content_type_id)
 obj = content_type.get_object_for_this_type(pk=object_id)
-except ObjectDoesNotExist:
+except (ObjectDoesNotExist, ValueError):
 raise http.Http404("Content type %s object %s doesn't exist" % 
(content_type_id, object_id))
 try:
 absurl = obj.get_absolute_url()

Modified: django/trunk/tests/regressiontests/views/tests/defaults.py
===
--- django/trunk/tests/regressiontests/views/tests/defaults.py  2009-12-19 
15:02:46 UTC (rev 11916)
+++ django/trunk/tests/regressiontests/views/tests/defaults.py  2009-12-19 
15:25:16 UTC (rev 11917)
@@ -10,8 +10,8 @@
 """Test django views in django/views/defaults.py"""
 fixtures = ['testdata.json']
 
-def test_shorcut_with_absolute_url(self):
-"Can view a shortcut an Author object that has with a get_absolute_url 
method"
+def test_shortcut_with_absolute_url(self):
+"Can view a shortcut for an Author object that has a get_absolute_url 
method"
 for obj in Author.objects.all():
 short_url = '/views/shortcut/%s/%s/' % 
(ContentType.objects.get_for_model(Author).id, obj.pk)
 response = self.client.get(short_url)
@@ -19,12 +19,34 @@
  status_code=302, target_status_code=404)
 
 def test_shortcut_no_absolute_url(self):
-"Shortcuts for an object that has with a get_absolute_url method 
raises 404"
+"Shortcuts for an object that has no get_absolute_url method raises 
404"
 for obj in Article.objects.all():
 short_url = '/views/shortcut/%s/%s/' % 
(ContentType.objects.get_for_model(Article).id, obj.pk)
 response = self.client.get(short_url)
 self.assertEquals(response.status_code, 404)
 
+def test_wrong_type_pk(self):
+short_url = '/views/shortcut/%s/%s/' % 
(ContentType.objects.get_for_model(Author).id, 'nobody/expects')
+response = self.client.get(short_url)
+self.assertEquals(response.status_code, 404)
+
+def test_shortcut_bad_pk(self):
+short_url = '/views/shortcut/%s/%s/' % 
(ContentType.objects.get_for_model(Author).id, '4242424242')
+response = self.client.get(short_url)
+self.assertEquals(response.status_code, 404)
+
+def test_nonint_content_type(self):
+an_author = Author.objects.all()[0]
+short_url = '/views/shortcut/%s/%s/' % ('spam', an_author.pk)
+response = self.client.get(short_url)
+self.assertEquals(response.status_code, 404)
+
+def test_bad_content_type(self):
+an_author = Author.objects.all()[0]
+short_url = '/views/shortcut/%s/%s/' % (4242424242, an_author.pk)
+response = self.client.get(short_url)
+self.assertEquals(response.status_code, 404)
+
 def test_page_not_found(self):
 "A 404 status is returned by the page_not_found view"
 non_existing_urls = ['/views/non_existing_url/', # this is in urls.py

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Django] #12405: django.contrib.auth.views.logout() should support LOGOUT_REDIRECT_URL

2009-12-19 Thread Django
#12405: django.contrib.auth.views.logout() should support LOGOUT_REDIRECT_URL
+---
 Reporter:  cmwslw  |   Owner:  nobody
   Status:  new |   Milestone:
Component:  Authentication  | Version:  1.1   
 Keywords:  logout LOGOUT_REDIRECT_URL  |   Stage:  Unreviewed
Has_patch:  0   |  
+---
 I was wondering why django.contrib.auth.views.logout() doesn't support a
 REDIRECT_URL override in the settings file as login() does. I'm aware that
 it is possible to specify a next_page argument, however, this is
 cumbersome if the urls.py containing logout() is a third party library
 such as django-registration. I haven't taken a good look at the source,
 but I am guessing this would be a simple patch to write in order to
 support LOGOUT_REDIRECT_URL. Before I work on it, I need to know if there
 are any possible regressions or if there are any opinions against this.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Changeset] r11916 - django/trunk/django/db/models

2009-12-19 Thread noreply
Author: lukeplant
Date: 2009-12-19 09:02:46 -0600 (Sat, 19 Dec 2009)
New Revision: 11916

Modified:
   django/trunk/django/db/models/query.py
Log:
Fixed #12258 - QuerySet.get() should clear ordering.

We only clear ordering when doing so cannot change the result returned by
the get() method i.e.  when the query does not already define limits.

Thanks to mattdennew...@gmail.com for the report, and jdunck for the patch



Modified: django/trunk/django/db/models/query.py
===
--- django/trunk/django/db/models/query.py  2009-12-19 14:50:41 UTC (rev 
11915)
+++ django/trunk/django/db/models/query.py  2009-12-19 15:02:46 UTC (rev 
11916)
@@ -320,6 +320,8 @@
 keyword arguments.
 """
 clone = self.filter(*args, **kwargs)
+if self.query.can_filter():
+clone = clone.order_by()
 num = len(clone)
 if num == 1:
 return clone._result_cache[0]

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Changeset] r11915 - in django/trunk: django/db/models tests/modeltests/lookup

2009-12-19 Thread noreply
Author: lukeplant
Date: 2009-12-19 08:50:41 -0600 (Sat, 19 Dec 2009)
New Revision: 11915

Modified:
   django/trunk/django/db/models/query.py
   django/trunk/tests/modeltests/lookup/models.py
Log:
Fixed #12251 - QuerySet.in_bulk() should accept set/frozenset

Thanks to emulbreh for patch.



Modified: django/trunk/django/db/models/query.py
===
--- django/trunk/django/db/models/query.py  2009-12-19 14:27:26 UTC (rev 
11914)
+++ django/trunk/django/db/models/query.py  2009-12-19 14:50:41 UTC (rev 
11915)
@@ -386,7 +386,7 @@
 """
 assert self.query.can_filter(), \
 "Cannot use 'limit' or 'offset' with in_bulk"
-assert isinstance(id_list, (tuple,  list)), \
+assert isinstance(id_list, (tuple,  list, set, frozenset)), \
 "in_bulk() must be provided with a list of IDs."
 if not id_list:
 return {}

Modified: django/trunk/tests/modeltests/lookup/models.py
===
--- django/trunk/tests/modeltests/lookup/models.py  2009-12-19 14:27:26 UTC 
(rev 11914)
+++ django/trunk/tests/modeltests/lookup/models.py  2009-12-19 14:50:41 UTC 
(rev 11915)
@@ -102,6 +102,12 @@
 
 >>> Article.objects.in_bulk([3])
 {3: }
+>>> Article.objects.in_bulk(set([3]))
+{3: }
+>>> Article.objects.in_bulk(frozenset([3]))
+{3: }
+>>> Article.objects.in_bulk((3,))
+{3: }
 >>> Article.objects.in_bulk([1000])
 {}
 >>> Article.objects.in_bulk([])

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #12386: Automatic ManyToMany Fields in models defined in packages use invalid column names

2009-12-19 Thread Django
#12386: Automatic ManyToMany Fields in models defined in packages use invalid
column names
---+
  Reporter:  ldevesine | Owner:  nobody
Status:  closed| Milestone:
 Component:  Database layer (models, ORM)  |   Version:  SVN   
Resolution:  worksforme|  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by ramiro):

  * status:  new => closed
  * resolution:  => worksforme

Comment:

 I can't reproduce this. FInd attached an hypothetical
 `model_package_regress` regression test that shows Django is generation
 correct table and column names for the m2m field (tested with sqlite3
 here) between two models defined in a `models` package.

 I'm going to close this ticket. Reopen it you can modify the test case to
 exactly reproduce your setup and you reproduce the error you report. If
 so, include a patch or an exact copy of the code. Thanks.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Changeset] r11914 - in django/trunk: django/core/management/commands tests/modeltests tests/modeltests/fixtures_model_package tests/modeltests/fixtures_model_package/fixtures tests/modeltests/fixture

2009-12-19 Thread noreply
Author: lukeplant
Date: 2009-12-19 08:27:26 -0600 (Sat, 19 Dec 2009)
New Revision: 11914

Added:
   django/trunk/tests/modeltests/fixtures_model_package/
   django/trunk/tests/modeltests/fixtures_model_package/__init__.py
   django/trunk/tests/modeltests/fixtures_model_package/fixtures/
   django/trunk/tests/modeltests/fixtures_model_package/fixtures/fixture1.json
   django/trunk/tests/modeltests/fixtures_model_package/fixtures/fixture2.json
   django/trunk/tests/modeltests/fixtures_model_package/fixtures/fixture2.xml
   
django/trunk/tests/modeltests/fixtures_model_package/fixtures/initial_data.json
   django/trunk/tests/modeltests/fixtures_model_package/models/
   django/trunk/tests/modeltests/fixtures_model_package/models/__init__.py
Modified:
   django/trunk/django/core/management/commands/loaddata.py
Log:
Fixed #6961 - loaddata fails if models is a package instead of a module

Thanks to pmd for report, zhaoz, mmalone and justinlilly for patch



Modified: django/trunk/django/core/management/commands/loaddata.py
===
--- django/trunk/django/core/management/commands/loaddata.py2009-12-19 
08:24:20 UTC (rev 11913)
+++ django/trunk/django/core/management/commands/loaddata.py2009-12-19 
14:27:26 UTC (rev 11914)
@@ -76,7 +76,17 @@
 if has_bz2:
 compression_types['bz2'] = bz2.BZ2File
 
-app_fixtures = [os.path.join(os.path.dirname(app.__file__), 
'fixtures') for app in get_apps()]
+app_module_paths = []
+for app in get_apps():
+if hasattr(app, '__path__'):
+# It's a 'models/' subpackage
+for path in app.__path__:
+app_module_paths.append(path)
+else:
+# It's a models.py module
+app_module_paths.append(app.__file__)
+
+app_fixtures = [os.path.join(os.path.dirname(path), 'fixtures') for 
path in app_module_paths]
 for fixture_label in fixture_labels:
 parts = fixture_label.split('.')
 

Added: django/trunk/tests/modeltests/fixtures_model_package/__init__.py
===
--- django/trunk/tests/modeltests/fixtures_model_package/__init__.py
(rev 0)
+++ django/trunk/tests/modeltests/fixtures_model_package/__init__.py
2009-12-19 14:27:26 UTC (rev 11914)
@@ -0,0 +1,2 @@
+
+


Property changes on: 
django/trunk/tests/modeltests/fixtures_model_package/__init__.py
___
Name: svn:eol-style
   + native

Added: 
django/trunk/tests/modeltests/fixtures_model_package/fixtures/fixture1.json
===
--- django/trunk/tests/modeltests/fixtures_model_package/fixtures/fixture1.json 
(rev 0)
+++ django/trunk/tests/modeltests/fixtures_model_package/fixtures/fixture1.json 
2009-12-19 14:27:26 UTC (rev 11914)
@@ -0,0 +1,18 @@
+[
+{
+"pk": "2", 
+"model": "fixtures_model_package.article", 
+"fields": {
+"headline": "Poker has no place on ESPN", 
+"pub_date": "2006-06-16 12:00:00"
+}
+}, 
+{
+"pk": "3", 
+"model": "fixtures_model_package.article", 
+"fields": {
+"headline": "Time to reform copyright", 
+"pub_date": "2006-06-16 13:00:00"
+}
+}
+]

Added: 
django/trunk/tests/modeltests/fixtures_model_package/fixtures/fixture2.json
===
--- django/trunk/tests/modeltests/fixtures_model_package/fixtures/fixture2.json 
(rev 0)
+++ django/trunk/tests/modeltests/fixtures_model_package/fixtures/fixture2.json 
2009-12-19 14:27:26 UTC (rev 11914)
@@ -0,0 +1,18 @@
+[
+{
+"pk": "3", 
+"model": "fixtures_model_package.article", 
+"fields": {
+"headline": "Copyright is fine the way it is", 
+"pub_date": "2006-06-16 14:00:00"
+}
+}, 
+{
+"pk": "4", 
+"model": "fixtures_model_package.article", 
+"fields": {
+"headline": "Django conquers world!", 
+"pub_date": "2006-06-16 15:00:00"
+}
+}
+]

Added: 
django/trunk/tests/modeltests/fixtures_model_package/fixtures/fixture2.xml
===
--- django/trunk/tests/modeltests/fixtures_model_package/fixtures/fixture2.xml  
(rev 0)
+++ django/trunk/tests/modeltests/fixtures_model_package/fixtures/fixture2.xml  
2009-12-19 14:27:26 UTC (rev 11914)
@@ -0,0 +1,11 @@
+
+
+
+Poker on TV is great!
+2006-06-16 11:00:00
+
+
+XML identified as leading 
cause of cancer
+2006-06-16 16:00:00
+
+

Added: 
django/trunk/tests/modeltests/fixtures_model_package/fixtures/initial_data.json
=

Re: [Django] #11863: Add a method to the orm to create Model instances from raw sql queries

2009-12-19 Thread Django
#11863: Add a method to the orm to create Model instances from raw sql queries
---+
  Reporter:  seanoc| Owner:  seanoc
Status:  assigned  | Milestone:  1.2   
 Component:  Database layer (models, ORM)  |   Version:  SVN   
Resolution:|  Keywords:
 Stage:  Unreviewed| Has_patch:  1 
Needs_docs:  1 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Comment (by jacob):

 Russ - it appears your latest patch is missing the tests. If you'll upload
 a new one I'll take a look and then commit it, or else feel free to commit
 yourself.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #11017: Oracle LIKEC query doesn't use index

2009-12-19 Thread Django
#11017: Oracle LIKEC query doesn't use index
---+
  Reporter:  jtiai | Owner:  nobody
Status:  new   | Milestone:  1.2   
 Component:  Database layer (models, ORM)  |   Version:  SVN   
Resolution:|  Keywords:  oracle
 Stage:  Accepted  | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Comment (by ikelly):

 Thanks for tracking down that bug.  I'm fairly sure that Frank was using
 Oracle 9 when he reported #5985, so this is quite likely the same bug.
 I'm reluctant to just revert the change since that would cause a
 regression of #5985, but I'm definitely willing to consider the
 workaround.  I also wonder if it might be fixed a bit more efficiently by:
 {{{
 LIKE %s ESCAPE N'\\'
 }}}
 Unfortunately, I don't have a 9.2.0.5 database available to test on.  Do
 you?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #11333: ORA-01830 date format picture ends before converting entire input

2009-12-19 Thread Django
#11333: ORA-01830 date format picture ends before converting entire input
---+
  Reporter:  jtiai | Owner:  nobody 

Status:  new   | Milestone: 

 Component:  Database layer (models, ORM)  |   Version:  SVN

Resolution:|  Keywords:  oracle 
date formats
 Stage:  Unreviewed| Has_patch:  0  

Needs_docs:  0 |   Needs_tests:  0  

Needs_better_patch:  0 |  
---+
Changes (by anonymous):

  * needs_better_patch:  => 0
  * component:  Uncategorized => Database layer (models, ORM)
  * needs_tests:  => 0
  * needs_docs:  => 0

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Changeset] r11913 - in django/branches/releases/1.1.X: django/db/backends/postgresql docs/ref

2009-12-19 Thread noreply
Author: jbronn
Date: 2009-12-19 02:24:20 -0600 (Sat, 19 Dec 2009)
New Revision: 11913

Modified:
   django/branches/releases/1.1.X/django/db/backends/postgresql/creation.py
   django/branches/releases/1.1.X/docs/ref/databases.txt
Log:
[1.1.X] Fixed #12234 -- Create additional indexes that use the appropriate 
operation class for PostgreSQL `varchar` and `text` columns when 
`db_index=True`.

Backport of r11912 from trunk.


Modified: 
django/branches/releases/1.1.X/django/db/backends/postgresql/creation.py
===
--- django/branches/releases/1.1.X/django/db/backends/postgresql/creation.py
2009-12-19 08:19:38 UTC (rev 11912)
+++ django/branches/releases/1.1.X/django/db/backends/postgresql/creation.py
2009-12-19 08:24:20 UTC (rev 11913)
@@ -34,3 +34,42 @@
 if settings.TEST_DATABASE_CHARSET:
 return "WITH ENCODING '%s'" % settings.TEST_DATABASE_CHARSET
 return ''
+
+def sql_indexes_for_field(self, model, f, style):
+if f.db_index and not f.unique:
+qn = self.connection.ops.quote_name
+db_table = model._meta.db_table
+tablespace = f.db_tablespace or model._meta.db_tablespace
+if tablespace:
+sql = self.connection.ops.tablespace_sql(tablespace)
+if sql:
+tablespace_sql = ' ' + sql
+else:
+tablespace_sql = ''
+else:
+tablespace_sql = ''
+
+def get_index_sql(index_name, opclass=''):
+return (style.SQL_KEYWORD('CREATE INDEX') + ' ' +
+style.SQL_TABLE(qn(index_name)) + ' ' +
+style.SQL_KEYWORD('ON') + ' ' +
+style.SQL_TABLE(qn(db_table)) + ' ' +
+"(%s%s)" % (style.SQL_FIELD(qn(f.column)), opclass) +
+"%s;" % tablespace_sql)
+
+output = [get_index_sql('%s_%s' % (db_table, f.column))]
+
+# Fields with database column types of `varchar` and `text` need
+# a second index that specifies their operator class, which is
+# needed when performing correct LIKE queries outside the
+# C locale. See #12234.
+db_type = f.db_type()
+if db_type.startswith('varchar'):
+output.append(get_index_sql('%s_%s_like' % (db_table, 
f.column),
+' varchar_pattern_ops'))
+elif db_type.startswith('text'):
+output.append(get_index_sql('%s_%s_like' % (db_table, 
f.column),
+' text_pattern_ops'))
+else:
+output = []
+return output

Modified: django/branches/releases/1.1.X/docs/ref/databases.txt
===
--- django/branches/releases/1.1.X/docs/ref/databases.txt   2009-12-19 
08:19:38 UTC (rev 11912)
+++ django/branches/releases/1.1.X/docs/ref/databases.txt   2009-12-19 
08:24:20 UTC (rev 11913)
@@ -80,6 +80,21 @@
 before enabling this feature. It's faster, but it provides less automatic
 protection for multi-call operations.
 
+Indexes for ``varchar`` and ``text`` columns
+
+.. versionadded:: 1.1.2
+
+When specifying ``db_index=True`` on your model fields, Django typically
+outputs a single ``CREATE INDEX`` statement.  However, if the database type
+for the field is either ``varchar`` or ``text`` (e.g., used by ``CharField``,
+``FileField``, and ``TextField``), then Django will create
+an additional index that uses an appropriate `PostgreSQL operator class`_
+for the column.  The extra index is necessary to correctly perfrom
+lookups that use the ``LIKE`` operator in their SQL, as is done with the
+``contains`` and ``startswith`` lookup types.
+
+.. _PostgreSQL operator class: 
http://www.postgresql.org/docs/8.4/static/indexes-opclass.html
+
 .. _mysql-notes:
 
 MySQL notes

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




[Changeset] r11912 - in django/trunk: django/db/backends/postgresql docs/ref

2009-12-19 Thread noreply
Author: jbronn
Date: 2009-12-19 02:19:38 -0600 (Sat, 19 Dec 2009)
New Revision: 11912

Modified:
   django/trunk/django/db/backends/postgresql/creation.py
   django/trunk/docs/ref/databases.txt
Log:
Fixed #12234 -- Create additional indexes that use the appropriate operation 
class for PostgreSQL `varchar` and `text` columns when `db_index=True`.


Modified: django/trunk/django/db/backends/postgresql/creation.py
===
--- django/trunk/django/db/backends/postgresql/creation.py  2009-12-19 
01:11:33 UTC (rev 11911)
+++ django/trunk/django/db/backends/postgresql/creation.py  2009-12-19 
08:19:38 UTC (rev 11912)
@@ -35,3 +35,42 @@
 if settings.TEST_DATABASE_CHARSET:
 return "WITH ENCODING '%s'" % settings.TEST_DATABASE_CHARSET
 return ''
+
+def sql_indexes_for_field(self, model, f, style):
+if f.db_index and not f.unique:
+qn = self.connection.ops.quote_name
+db_table = model._meta.db_table
+tablespace = f.db_tablespace or model._meta.db_tablespace
+if tablespace:
+sql = self.connection.ops.tablespace_sql(tablespace)
+if sql:
+tablespace_sql = ' ' + sql
+else:
+tablespace_sql = ''
+else:
+tablespace_sql = ''
+
+def get_index_sql(index_name, opclass=''):
+return (style.SQL_KEYWORD('CREATE INDEX') + ' ' +
+style.SQL_TABLE(qn(index_name)) + ' ' +
+style.SQL_KEYWORD('ON') + ' ' +
+style.SQL_TABLE(qn(db_table)) + ' ' +
+"(%s%s)" % (style.SQL_FIELD(qn(f.column)), opclass) +
+"%s;" % tablespace_sql)
+
+output = [get_index_sql('%s_%s' % (db_table, f.column))]
+
+# Fields with database column types of `varchar` and `text` need
+# a second index that specifies their operator class, which is
+# needed when performing correct LIKE queries outside the
+# C locale. See #12234.
+db_type = f.db_type()
+if db_type.startswith('varchar'):
+output.append(get_index_sql('%s_%s_like' % (db_table, 
f.column),
+' varchar_pattern_ops'))
+elif db_type.startswith('text'):
+output.append(get_index_sql('%s_%s_like' % (db_table, 
f.column),
+' text_pattern_ops'))
+else:
+output = []
+return output

Modified: django/trunk/docs/ref/databases.txt
===
--- django/trunk/docs/ref/databases.txt 2009-12-19 01:11:33 UTC (rev 11911)
+++ django/trunk/docs/ref/databases.txt 2009-12-19 08:19:38 UTC (rev 11912)
@@ -80,6 +80,21 @@
 before enabling this feature. It's faster, but it provides less automatic
 protection for multi-call operations.
 
+Indexes for ``varchar`` and ``text`` columns
+
+.. versionadded:: 1.1.2
+
+When specifying ``db_index=True`` on your model fields, Django typically
+outputs a single ``CREATE INDEX`` statement.  However, if the database type
+for the field is either ``varchar`` or ``text`` (e.g., used by ``CharField``,
+``FileField``, and ``TextField``), then Django will create
+an additional index that uses an appropriate `PostgreSQL operator class`_
+for the column.  The extra index is necessary to correctly perfrom
+lookups that use the ``LIKE`` operator in their SQL, as is done with the
+``contains`` and ``startswith`` lookup types.
+
+.. _PostgreSQL operator class: 
http://www.postgresql.org/docs/8.4/static/indexes-opclass.html
+
 .. _mysql-notes:
 
 MySQL notes

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.