[Changeset] r10385 - in django/trunk: django/core tests/regressiontests/urlpatterns_reverse

2009-04-03 Thread noreply

Author: russellm
Date: 2009-04-04 01:54:56 -0500 (Sat, 04 Apr 2009)
New Revision: 10385

Added:
   django/trunk/tests/regressiontests/urlpatterns_reverse/no_urls.py
Modified:
   django/trunk/django/core/urlresolvers.py
   django/trunk/tests/regressiontests/urlpatterns_reverse/tests.py
Log:
Fixed #10065 -- Corrected an error message when an empty urlpattern object is 
provided. Thanks to Matthew Flanagan for the patch.

Modified: django/trunk/django/core/urlresolvers.py
===
--- django/trunk/django/core/urlresolvers.py2009-04-04 05:35:01 UTC (rev 
10384)
+++ django/trunk/django/core/urlresolvers.py2009-04-04 06:54:56 UTC (rev 
10385)
@@ -209,7 +209,7 @@
 try:
 iter(patterns)
 except TypeError:
-raise ImproperlyConfigured("The included urlconf %s doesn't have 
any"
+raise ImproperlyConfigured("The included urlconf %s doesn't have 
any "
 "patterns in it" % self.urlconf_name)
 return patterns
 url_patterns = property(_get_url_patterns)

Added: django/trunk/tests/regressiontests/urlpatterns_reverse/no_urls.py
===
--- django/trunk/tests/regressiontests/urlpatterns_reverse/no_urls.py   
(rev 0)
+++ django/trunk/tests/regressiontests/urlpatterns_reverse/no_urls.py   
2009-04-04 06:54:56 UTC (rev 10385)
@@ -0,0 +1,2 @@
+#from django.conf.urls.defaults import *
+

Modified: django/trunk/tests/regressiontests/urlpatterns_reverse/tests.py
===
--- django/trunk/tests/regressiontests/urlpatterns_reverse/tests.py 
2009-04-04 05:35:01 UTC (rev 10384)
+++ django/trunk/tests/regressiontests/urlpatterns_reverse/tests.py 
2009-04-04 06:54:56 UTC (rev 10385)
@@ -1,7 +1,20 @@
 """
 Unit tests for reverse URL lookups.
 """
+__test__ = {'API_TESTS': """
 
+RegexURLResolver should raise an exception when no urlpatterns exist.
+
+>>> from django.core.urlresolvers import RegexURLResolver
+>>> no_urls = 'regressiontests.urlpatterns_reverse.no_urls'
+>>> resolver = RegexURLResolver(r'^$', no_urls)
+>>> resolver.url_patterns
+Traceback (most recent call last):
+...
+ImproperlyConfigured: The included urlconf 
regressiontests.urlpatterns_reverse.no_urls doesn't have any patterns in it
+"""}
+
+
 from django.core.urlresolvers import reverse, NoReverseMatch
 from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect
 from django.shortcuts import redirect
@@ -101,21 +114,21 @@
 
 class ReverseShortcutTests(TestCase):
 urls = 'regressiontests.urlpatterns_reverse.urls'
-
+
 def test_redirect_to_object(self):
 # We don't really need a model; just something with a get_absolute_url
 class FakeObj(object):
 def get_absolute_url(self):
 return "/hi-there/"
-
+
 res = redirect(FakeObj())
 self.assert_(isinstance(res, HttpResponseRedirect))
 self.assertEqual(res['Location'], '/hi-there/')
-
+
 res = redirect(FakeObj(), permanent=True)
 self.assert_(isinstance(res, HttpResponsePermanentRedirect))
 self.assertEqual(res['Location'], '/hi-there/')
-
+
 def test_redirect_to_view_name(self):
 res = redirect('hardcoded2')
 self.assertEqual(res['Location'], '/hardcoded/doc.pdf')
@@ -124,7 +137,7 @@
 res = redirect('headlines', year='2008', month='02', day='17')
 self.assertEqual(res['Location'], '/headlines/2008.02.17/')
 self.assertRaises(NoReverseMatch, redirect, 'not-a-view')
-
+
 def test_redirect_to_url(self):
 res = redirect('/foo/')
 self.assertEqual(res['Location'], '/foo/')


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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] #10723: ORM exclute strange

2009-04-03 Thread Django
#10723: ORM exclute strange
---+
  Reporter:  anonymous | Owner:  nobody
Status:  new   | Milestone:  1.1   
 Component:  Database layer (models, ORM)  |   Version:  SVN   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Comment (by anonymous):

 I think that the correct SQL is:
 {{{
 ('SELECT `doska_type`.`id`, `doska_type`.`slug`,
 `doska_type`.`weight`, COUNT(`doska_active_new`.`id`) AS `count`
 FROM `doska_type` LEFT OUTER JOIN `doska_active_new`
ON (`doska_type`.`id` = `doska_active_new`.`type_id`)
 WHERE (`doska_active_new`.`rubrica_id` = %s
AND `doska_active_new`.`user_id` NOT IN (%s, %s, %s
 GROUP BY `doska_type`.`id`
 ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
 }}}

-- 
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-updates@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] #10710: Invalid results with only() when model has two foreign keys to other models that inherit from a single abstract parent

2009-04-03 Thread Django
#10710: Invalid results with only() when model has two foreign keys to other 
models
that inherit from a single abstract parent
---+
  Reporter:  mrts  | Owner:  nobody
Status:  closed| Milestone:  1.1   
 Component:  Database layer (models, ORM)  |   Version:  SVN   
Resolution:  fixed |  Keywords:  defer only
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by mtredinnick):

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

Comment:

 The second problem here was fixed in r10384.

-- 
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-updates@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] r10384 - in django/trunk: django/db/models/sql tests/regressiontests/defer_regress

2009-04-03 Thread noreply

Author: mtredinnick
Date: 2009-04-04 00:35:01 -0500 (Sat, 04 Apr 2009)
New Revision: 10384

Modified:
   django/trunk/django/db/models/sql/query.py
   django/trunk/tests/regressiontests/defer_regress/models.py
Log:
Fixed a problem when computing deferred fields on multiple related models.

Fixed #10710, as this fixes the second bug reported there.

Modified: django/trunk/django/db/models/sql/query.py
===
--- django/trunk/django/db/models/sql/query.py  2009-04-04 05:34:23 UTC (rev 
10383)
+++ django/trunk/django/db/models/sql/query.py  2009-04-04 05:35:01 UTC (rev 
10384)
@@ -574,12 +574,13 @@
 if not field_names:
 return
 columns = set()
-cur_model = self.model
-opts = cur_model._meta
+orig_opts = self.model._meta
 seen = {}
-must_include = {cur_model: set([opts.pk])}
+must_include = {self.model: set([orig_opts.pk])}
 for field_name in field_names:
 parts = field_name.split(LOOKUP_SEP)
+cur_model = self.model
+opts = orig_opts
 for name in parts[:-1]:
 old_model = cur_model
 source = opts.get_field_by_name(name)[0]

Modified: django/trunk/tests/regressiontests/defer_regress/models.py
===
--- django/trunk/tests/regressiontests/defer_regress/models.py  2009-04-04 
05:34:23 UTC (rev 10383)
+++ django/trunk/tests/regressiontests/defer_regress/models.py  2009-04-04 
05:35:01 UTC (rev 10384)
@@ -24,6 +24,7 @@
 class Leaf(models.Model):
 name = models.CharField(max_length=10)
 child = models.ForeignKey(Child)
+second_child = models.ForeignKey(Child, related_name="other", null=True)
 value = models.IntegerField(default=42)
 
 def __unicode__(self):
@@ -87,6 +88,8 @@
 >>> obj = Leaf.objects.only("name", "child").select_related()[0]
 >>> obj.child.name
 u'c1'
+>>> Leaf.objects.select_related().only("child__name", "second_child__name")
+[]
 
 """
 }


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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] r10383 - in django/trunk: django/db/models tests/regressiontests/defer_regress

2009-04-03 Thread noreply

Author: mtredinnick
Date: 2009-04-04 00:34:23 -0500 (Sat, 04 Apr 2009)
New Revision: 10383

Modified:
   django/trunk/django/db/models/query.py
   django/trunk/tests/regressiontests/defer_regress/models.py
Log:
Fixed deferred fields and select_related() interaction.

Loading related models when some fields were deferred was resulting in
incorrect offsets being used into the results row, causing the wrong data to be
assigned to attributes.

Refs #10710. This fixes the first of two bugs reported there.

Modified: django/trunk/django/db/models/query.py
===
--- django/trunk/django/db/models/query.py  2009-04-04 03:21:31 UTC (rev 
10382)
+++ django/trunk/django/db/models/query.py  2009-04-04 05:34:23 UTC (rev 
10383)
@@ -908,31 +908,35 @@
 return None
 
 restricted = requested is not None
-index_end = index_start + len(klass._meta.fields)
-fields = row[index_start:index_end]
-if not [x for x in fields if x is not None]:
-# If we only have a list of Nones, there was not related object.
-obj = None
-else:
-load_fields = only_load and only_load.get(klass) or None
-if load_fields:
-# Handle deferred fields.
-skip = set()
-init_list = []
-pk_val = fields[klass._meta.pk_index()]
-for field in klass._meta.fields:
-if field.name not in load_fields:
-skip.add(field.name)
-else:
-init_list.append(field.attname)
-if skip:
-klass = deferred_class_factory(klass, skip)
-obj = klass(**dict(zip(init_list, fields)))
+load_fields = only_load and only_load.get(klass) or None
+if load_fields:
+# Handle deferred fields.
+skip = set()
+init_list = []
+pk_val = row[index_start + klass._meta.pk_index()]
+for field in klass._meta.fields:
+if field.name not in load_fields:
+skip.add(field.name)
 else:
-obj = klass(*fields)
+init_list.append(field.attname)
+field_count = len(init_list)
+fields = row[index_start : index_start + field_count]
+if fields == (None,) * field_count:
+obj = None
+elif skip:
+klass = deferred_class_factory(klass, skip)
+obj = klass(**dict(zip(init_list, fields)))
 else:
 obj = klass(*fields)
-index_end += offset
+else:
+field_count = len(klass._meta.fields)
+fields = row[index_start : index_start + field_count]
+if fields == (None,) * field_count:
+obj = None
+else:
+obj = klass(*fields)
+
+index_end = index_start + field_count + offset
 for f in klass._meta.fields:
 if not select_related_descend(f, restricted, requested):
 continue
@@ -948,7 +952,6 @@
 setattr(obj, f.get_cache_name(), rel_obj)
 return obj, index_end
 
-
 def delete_objects(seen_objs):
 """
 Iterate through a list of seen classes, and remove any instances that are

Modified: django/trunk/tests/regressiontests/defer_regress/models.py
===
--- django/trunk/tests/regressiontests/defer_regress/models.py  2009-04-04 
03:21:31 UTC (rev 10382)
+++ django/trunk/tests/regressiontests/defer_regress/models.py  2009-04-04 
05:34:23 UTC (rev 10383)
@@ -17,6 +17,18 @@
 class RelatedItem(models.Model):
 item = models.ForeignKey(Item)
 
+class Child(models.Model):
+name = models.CharField(max_length=10)
+value = models.IntegerField()
+
+class Leaf(models.Model):
+name = models.CharField(max_length=10)
+child = models.ForeignKey(Child)
+value = models.IntegerField(default=42)
+
+def __unicode__(self):
+return self.name
+
 __test__ = {"regression_tests": """
 Deferred fields should really be deferred and not accidentally use the field's
 default value just because they aren't passed to __init__.
@@ -66,7 +78,15 @@
 >>> r.item == i
 True
 
+Some further checks for select_related() and inherited model behaviour
+(regression for #10710).
 
+>>> c1 = Child.objects.create(name="c1", value=42)
+>>> obj = Leaf.objects.create(name="l1", child=c1)
 
+>>> obj = Leaf.objects.only("name", "child").select_related()[0]
+>>> obj.child.name
+u'c1'
+
 """
 }


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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] #10438: Rowcount for updates not correct with MySQL

2009-04-03 Thread Django
#10438: Rowcount for updates not correct with MySQL
---+
  Reporter:  mtredinnick   | Owner:  nobody
Status:  new   | Milestone:  1.1   
 Component:  Database layer (models, ORM)  |   Version:  SVN   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by Daniel Tang ):

  * has_patch:  0 => 1

Comment:

 Also sent to django-developers:

 Not sure if this is an end-all solution, but you can pass a client_flag
 kwarg that makes MySQLdb return the number of matched rows instead of
 affected rows. In MySQLdb.constants.CLIENT there is a FOUND_ROWS constant.
 Passing it to connect resolves this problem. Patch attached just to show
 what I did.

-- 
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-updates@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] #10723: ORM exclute strange

2009-04-03 Thread Django
#10723: ORM exclute strange
---+
  Reporter:  anonymous | Owner:  nobody
Status:  new   | Milestone:  1.1   
 Component:  Database layer (models, ORM)  |   Version:  SVN   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Old description:

> My models is:
> {{{
> #!python
> class Type(models.Model):
> id = models.AutoField(primary_key=True)
> slug = models.SlugField(unique=True, max_length=10)
> title = models.CharField(max_length=20)
> weight = models.SmallIntegerField(default=0, db_index=True)
>
> class Active(models.Model):
> post = models.ForeignKey(Post, related_name='activeposts')
> rubrica = models.ForeignKey(Rubrica, related_name='activeposts')
> type = models.ForeignKey(Type, related_name='activeposts')
> user_id = models.PositiveIntegerField()
> pub_date = models.DateTimeField(default=datetime.now)
> }}}
>

> {{{
> #!python
> Type.objects.filter(Q(activeposts__rubrica__pk=112) & \
>Q(activeposts__user_id__in= 1,2,3])). \
>annotate(count=Count('activeposts')).query.as_sql()
> }}}
>
> Result is correct:
>
> {{{
> #!sql
> ('SELECT `doska_type`.`id`, `doska_type`.`slug`,
> `doska_type`.`weight`, COUNT(`doska_active_new`.`id`) AS `count`
> FROM `doska_type` LEFT OUTER JOIN `doska_active_new`
>   ON (`doska_type`.`id` = `doska_active_new`.`type_id`)
> WHERE (`doska_active_new`.`rubrica_id` = %s
>AND `doska_active_new`.`user_id` IN (%s, %s, %s))
> GROUP BY `doska_type`.`id`
> ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
> }}}
> But
> {{{
> #!python
> Type.objects.filter(Q(activeposts__rubrica__pk=112) & \
> ~Q(activeposts__user_id__in=[1,2,3])). \
> annotate(count=Count('activeposts')).query.as_sql()
> }}}
>
> Result is not correct:
>
> {{{
> #!sql
> ('SELECT `doska_type`.`id`, `doska_type`.`slug`,
> `doska_type`.`weight`, COUNT(`doska_active_new`.`id`) AS `count`
> FROM `doska_type` LEFT OUTER JOIN `doska_active_new`
>ON (`doska_type`.`id` = `doska_active_new`.`type_id`)
> WHERE (`doska_active_new`.`rubrica_id` = %s
>AND NOT (`doska_type`.`id` IN (
>   SELECT U1.`type_id`
>   FROM `doska_active_new` U1
>   WHERE U1.`user_id` IN (%s, %s, %s
> GROUP BY `doska_type`.`id`
> ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
> }}}

New description:

 My models is:
 {{{
 #!python
 class Type(models.Model):
 id = models.AutoField(primary_key=True)
 slug = models.SlugField(unique=True, max_length=10)
 title = models.CharField(max_length=20)
 weight = models.SmallIntegerField(default=0, db_index=True)

 class Active(models.Model):
 post = models.ForeignKey(Post, related_name='activeposts')
 rubrica = models.ForeignKey(Rubrica, related_name='activeposts')
 type = models.ForeignKey(Type, related_name='activeposts')
 user_id = models.PositiveIntegerField()
 pub_date = models.DateTimeField(default=datetime.now)
 }}}


 {{{
 #!python
 Type.objects.filter(Q(activeposts__rubrica__pk=112) & \
Q(activeposts__user_id__in=[1,2,3])). \
annotate(count=Count('activeposts')).query.as_sql()
 }}}

 Result is correct:

 {{{
 #!sql
 ('SELECT `doska_type`.`id`, `doska_type`.`slug`,
 `doska_type`.`weight`, COUNT(`doska_active_new`.`id`) AS `count`
 FROM `doska_type` LEFT OUTER JOIN `doska_active_new`
   ON (`doska_type`.`id` = `doska_active_new`.`type_id`)
 WHERE (`doska_active_new`.`rubrica_id` = %s
AND `doska_active_new`.`user_id` IN (%s, %s, %s))
 GROUP BY `doska_type`.`id`
 ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
 }}}
 But
 {{{
 #!python
 Type.objects.filter(Q(activeposts__rubrica__pk=112) & \
 ~Q(activeposts__user_id__in=[1,2,3])). \
 annotate(count=Count('activeposts')).query.as_sql()
 }}}

 Result is not correct:

 {{{
 #!sql
 ('SELECT `doska_type`.`id`, `doska_type`.`slug`,
 `doska_type`.`weight`, COUNT(`doska_active_new`.`id`) AS `count`
 FROM `doska_type` LEFT OUTER JOIN `doska_active_new`
ON (`doska_type`.`id` = `doska_active_new`.`type_id`)
 WHERE (`doska_active_new`.`rubrica_id` = %s
AND NOT (`doska_type`.`id` IN (
   SELECT U1.`type_id`
   FROM `doska_active_new` U1
   WHERE U1.`user_id` IN (%s, %s, %s
 GROUP BY `doska_type`.`id`
 ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
 }}}

Comment (by mtredinnick):

 Are you actually seeing incorrect results returned from the database? What
 do you think the problem is here? I'm having trouble understanding what
 the bug might be and the SQL looks correct to me.

-- 
Ticket URL: 
Dj

Re: [Django] #10677: post_save_moderation breaks confirmation view

2009-04-03 Thread Django
#10677: post_save_moderation breaks confirmation view
--+-
  Reporter:  nate-dja...@refried.org  | Owner:  nobody  
  
Status:  new  | Milestone:  1.1 
  
 Component:  django.contrib.comments  |   Version:  1.1-beta-1  
  
Resolution:   |  Keywords:  django comments 
moderation
 Stage:  Accepted | Has_patch:  1   
  
Needs_docs:  0|   Needs_tests:  0   
  
Needs_better_patch:  0|  
--+-
Changes (by thejaswi_puthraya):

  * keywords:  => django comments moderation
  * has_patch:  0 => 1

Comment:

 The patch will delete the comment at the `comment_was_posted` signal
 handler and redirect to the `comment_done` or `next` page.

-- 
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-updates@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] #10695: defer() uses the same cached value for all models

2009-04-03 Thread Django
#10695: defer() uses the same cached value for all models
---+
  Reporter:  jbronn| Owner:  mtredinnick
Status:  closed| Milestone:  1.1
 Component:  Database layer (models, ORM)  |   Version:  SVN
Resolution:  fixed |  Keywords:  defer qs   
 Stage:  Accepted  | Has_patch:  1  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by mtredinnick):

  * status:  assigned => closed
  * resolution:  => fixed

Comment:

 Fixed in r10382.

-- 
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-updates@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] r10382 - in django/trunk: django/contrib/gis/tests/relatedapp django/db/models tests/regressiontests/defer_regress

2009-04-03 Thread noreply

Author: mtredinnick
Date: 2009-04-03 22:21:31 -0500 (Fri, 03 Apr 2009)
New Revision: 10382

Modified:
   django/trunk/django/contrib/gis/tests/relatedapp/tests.py
   django/trunk/django/db/models/base.py
   django/trunk/django/db/models/query.py
   django/trunk/django/db/models/query_utils.py
   django/trunk/tests/regressiontests/defer_regress/models.py
Log:
Fixed #10695 -- Fixed implementation of deferred attribute retrieval.

The original implementation had a few silly bugs in it that meant that data was
not being used only on the instance of the class that it was appropriate for
(one of the traps when using class-level things). No more!

Thanks to Justin Bronn and Alex Gaynor for the patch.

Modified: django/trunk/django/contrib/gis/tests/relatedapp/tests.py
===
--- django/trunk/django/contrib/gis/tests/relatedapp/tests.py   2009-04-04 
03:20:39 UTC (rev 10381)
+++ django/trunk/django/contrib/gis/tests/relatedapp/tests.py   2009-04-04 
03:21:31 UTC (rev 10382)
@@ -184,12 +184,12 @@
 self.assertEqual(m.point, t[1])
 
 # Test disabled until #10572 is resolved.
-#def test08_defer_only(self):
-#"Testing defer() and only() on Geographic models."
-#qs = Location.objects.all()
-#def_qs = Location.objects.defer('point')
-#for loc, def_loc in zip(qs, def_qs):
-#self.assertEqual(loc.point, def_loc.point)
+def test08_defer_only(self):
+"Testing defer() and only() on Geographic models."
+qs = Location.objects.all()
+def_qs = Location.objects.defer('point')
+for loc, def_loc in zip(qs, def_qs):
+self.assertEqual(loc.point, def_loc.point)
 
 # TODO: Related tests for KML, GML, and distance lookups.
 

Modified: django/trunk/django/db/models/base.py
===
--- django/trunk/django/db/models/base.py   2009-04-04 03:20:39 UTC (rev 
10381)
+++ django/trunk/django/db/models/base.py   2009-04-04 03:21:31 UTC (rev 
10382)
@@ -362,9 +362,8 @@
 # DeferredAttribute classes, so we only need to do this
 # once.
 obj = self.__class__.__dict__[field.attname]
-pk_val = obj.pk_value
 model = obj.model_ref()
-return (model_unpickle, (model, pk_val, defers), data)
+return (model_unpickle, (model, defers), data)
 
 def _get_pk_val(self, meta=None):
 if not meta:
@@ -635,12 +634,12 @@
 class Empty(object):
 pass
 
-def model_unpickle(model, pk_val, attrs):
+def model_unpickle(model, attrs):
 """
 Used to unpickle Model subclasses with deferred fields.
 """
 from django.db.models.query_utils import deferred_class_factory
-cls = deferred_class_factory(model, pk_val, attrs)
+cls = deferred_class_factory(model, attrs)
 return cls.__new__(cls)
 model_unpickle.__safe_for_unpickle__ = True
 

Modified: django/trunk/django/db/models/query.py
===
--- django/trunk/django/db/models/query.py  2009-04-04 03:20:39 UTC (rev 
10381)
+++ django/trunk/django/db/models/query.py  2009-04-04 03:21:31 UTC (rev 
10382)
@@ -190,6 +190,20 @@
 index_start = len(extra_select)
 aggregate_start = index_start + len(self.model._meta.fields)
 
+load_fields = only_load.get(self.model)
+skip = None
+if load_fields and not fill_cache:
+# Some fields have been deferred, so we have to initialise
+# via keyword arguments.
+skip = set()
+init_list = []
+for field in fields:
+if field.name not in load_fields:
+skip.add(field.attname)
+else:
+init_list.append(field.attname)
+model_cls = deferred_class_factory(self.model, skip)
+
 for row in self.query.results_iter():
 if fill_cache:
 obj, _ = get_cached_row(self.model, row,
@@ -197,25 +211,10 @@
 requested=requested, offset=len(aggregate_select),
 only_load=only_load)
 else:
-load_fields = only_load.get(self.model)
-if load_fields:
-# Some fields have been deferred, so we have to initialise
-# via keyword arguments.
+if skip:
 row_data = row[index_start:aggregate_start]
 pk_val = row_data[pk_idx]
-skip = set()
-init_list = []
-for field in fields:
-if field.name not in load_fields:
-skip.add(field.attname)
-else:
-init_list.append(field.attname)
-if skip:
-  

[Changeset] r10381 - django/trunk/django/contrib/gis/geos/tests

2009-04-03 Thread noreply

Author: mtredinnick
Date: 2009-04-03 22:20:39 -0500 (Fri, 03 Apr 2009)
New Revision: 10381

Modified:
   django/trunk/django/contrib/gis/geos/tests/test_io.py
Log:
Tweaked a GIS expected test failure.

The test was only checking for geos version 3.0.0, but it failed for all
3.0.x versions. This change makes the version check skip the test for
anything 3.0-ish.

Modified: django/trunk/django/contrib/gis/geos/tests/test_io.py
===
--- django/trunk/django/contrib/gis/geos/tests/test_io.py   2009-04-03 
20:53:50 UTC (rev 10380)
+++ django/trunk/django/contrib/gis/geos/tests/test_io.py   2009-04-04 
03:20:39 UTC (rev 10381)
@@ -91,7 +91,7 @@
 
 # These tests will fail on 3.0.0 because of a bug that was fixed in 
3.1:
 # http://trac.osgeo.org/geos/ticket/216
-if not geos_version_info()['version'] == '3.0.0':
+if not geos_version_info()['version'].startswith('3.0.'):
 # Now setting the output dimensions to be 3
 wkb_w.outdim = 3
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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] #10438: Rowcount for updates not correct with MySQL

2009-04-03 Thread Django
#10438: Rowcount for updates not correct with MySQL
---+
  Reporter:  mtredinnick   | Owner:  nobody
Status:  new   | Milestone:  1.1   
 Component:  Database layer (models, ORM)  |   Version:  SVN   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by mtredinnick):

  * milestone:  => 1.1

Comment:

 The issue at hand here is that MySQL returns the number of rows
 '''changed''' by an update, not the number of rows that were attempted to
 be updated, as the other databases do. We need to work around this
 somehow, as it's necessary to detect whether
 `Model.save(force_update=True)` worked or not.

 Possibly needs another MySQL-specific workaround to select the number of
 rows that might have been affected (a little racy, but that might just be
 the way it goes).

-- 
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-updates@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] #10648: Django should warn when creating a model with field called "save".

2009-04-03 Thread Django
#10648: Django should warn when creating a model with field called "save".
-+--
  Reporter:  Thomas Steinacher   | Owner:  
nobody
Status:  new | Milestone:   
 
 Component:  Database layer (models, ORM)|   Version:  1.0  
 
Resolution:  |  Keywords:   
 
 Stage:  Design decision needed  | Has_patch:  0
 
Needs_docs:  0   |   Needs_tests:  0
 
Needs_better_patch:  0   |  
-+--
Comment (by mtredinnick):

 If we do this, we shouldn't allow fields to replace any methods that
 already exist. "save" isn't special. Tend to agree with Jacob, though:
 this is a standard thing throughout Python. You have to be careful not to
 override parent class attributes and Django shouldn't try to be a "wrapped
 in cotton wool" version of Python, even by replacing Python warts.

-- 
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-updates@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] #10716: Syntax error and bug in db/backends/oracle/creation.py

2009-04-03 Thread Django
#10716: Syntax error and bug in db/backends/oracle/creation.py
---+
  Reporter:  canarix   | Owner:  nobody
Status:  new   | Milestone:  1.1   
 Component:  Database layer (models, ORM)  |   Version:  1.0   
Resolution:|  Keywords:  oracle
 Stage:  Accepted  | Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by mtredinnick):

  * needs_better_patch:  => 0
  * needs_docs:  => 0
  * stage:  Unreviewed => Accepted
  * needs_tests:  => 0
  * milestone:  => 1.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-updates@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] #10723: ORM exclute strange

2009-04-03 Thread Django
#10723: ORM exclute strange
---+
  Reporter:  anonymous | Owner:  nobody
Status:  new   | Milestone:  1.1   
 Component:  Database layer (models, ORM)  |   Version:  SVN   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by mtredinnick):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * milestone:  => 1.1
  * needs_docs:  => 0
  * stage:  Unreviewed => Accepted

Old description:

> My models is:
> {{{
> class Type(models.Model):
> id = models.AutoField(primary_key=True)
> slug = models.SlugField(unique=True, max_length=10)
> title = models.CharField(max_length=20)
> weight = models.SmallIntegerField(default=0, db_index=True)
>
> class Active(models.Model):
> post = models.ForeignKey(Post, related_name='activeposts')
> rubrica = models.ForeignKey(Rubrica, related_name='activeposts')
> type = models.ForeignKey(Type, related_name='activeposts')
> user_id = models.PositiveIntegerField()
> pub_date = models.DateTimeField(default=datetime.now)
> }}}
>

> {{{
> Type.objects.filter(Q(activeposts__rubrica__pk=112) &
> Q(activeposts__user_id__in=[1,2,3])).annotate(count=Count('activeposts')).query.as_sql()
> }}}
>
> Result is correct:
>
> {{{
> ('SELECT `doska_type`.`id`, `doska_type`.`slug`, `doska_type`.`weight`,
> COUNT(`doska_active_new`.`id`) AS `count` FROM `doska_type` LEFT OUTER
> JOIN `doska_active_new` ON (`doska_type`.`id` =
> `doska_active_new`.`type_id`) WHERE (`doska_active_new`.`rubrica_id` = %s
> AND `doska_active_new`.`user_id` IN (%s, %s, %s)) GROUP BY
> `doska_type`.`id` ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
> }}}
> But
> {{{
> Type.objects.filter(Q(activeposts__rubrica__pk=112) &
> ~Q(activeposts__user_id__in=[1,2,3])).annotate(count=Count('activeposts')).query.as_sql()
> }}}
>
> Result is not correct:
>
> {{{
> ('SELECT `doska_type`.`id`, `doska_type`.`slug`, `doska_type`.`weight`,
> COUNT(`doska_active_new`.`id`) AS `count` FROM `doska_type` LEFT OUTER
> JOIN `doska_active_new` ON (`doska_type`.`id` =
> `doska_active_new`.`type_id`) WHERE (`doska_active_new`.`rubrica_id` = %s
> AND NOT (`doska_type`.`id` IN (SELECT U1.`type_id` FROM
> `doska_active_new` U1 WHERE U1.`user_id` IN (%s, %s, %s GROUP BY
> `doska_type`.`id` ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
> }}}

New description:

 My models is:
 {{{
 #!python
 class Type(models.Model):
 id = models.AutoField(primary_key=True)
 slug = models.SlugField(unique=True, max_length=10)
 title = models.CharField(max_length=20)
 weight = models.SmallIntegerField(default=0, db_index=True)

 class Active(models.Model):
 post = models.ForeignKey(Post, related_name='activeposts')
 rubrica = models.ForeignKey(Rubrica, related_name='activeposts')
 type = models.ForeignKey(Type, related_name='activeposts')
 user_id = models.PositiveIntegerField()
 pub_date = models.DateTimeField(default=datetime.now)
 }}}


 {{{
 #!python
 Type.objects.filter(Q(activeposts__rubrica__pk=112) & \
Q(activeposts__user_id__in= 1,2,3])). \
annotate(count=Count('activeposts')).query.as_sql()
 }}}

 Result is correct:

 {{{
 #!sql
 ('SELECT `doska_type`.`id`, `doska_type`.`slug`,
 `doska_type`.`weight`, COUNT(`doska_active_new`.`id`) AS `count`
 FROM `doska_type` LEFT OUTER JOIN `doska_active_new`
   ON (`doska_type`.`id` = `doska_active_new`.`type_id`)
 WHERE (`doska_active_new`.`rubrica_id` = %s
AND `doska_active_new`.`user_id` IN (%s, %s, %s))
 GROUP BY `doska_type`.`id`
 ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
 }}}
 But
 {{{
 #!python
 Type.objects.filter(Q(activeposts__rubrica__pk=112) & \
 ~Q(activeposts__user_id__in=[1,2,3])). \
 annotate(count=Count('activeposts')).query.as_sql()
 }}}

 Result is not correct:

 {{{
 #!sql
 ('SELECT `doska_type`.`id`, `doska_type`.`slug`,
 `doska_type`.`weight`, COUNT(`doska_active_new`.`id`) AS `count`
 FROM `doska_type` LEFT OUTER JOIN `doska_active_new`
ON (`doska_type`.`id` = `doska_active_new`.`type_id`)
 WHERE (`doska_active_new`.`rubrica_id` = %s
AND NOT (`doska_type`.`id` IN (
   SELECT U1.`type_id`
   FROM `doska_active_new` U1
   WHERE U1.`user_id` IN (%s, %s, %s
 GROUP BY `doska_type`.`id`
 ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
 }}}

Comment:

 (Reformatted description to avoid lots of side-scrolling.)

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

Re: [Django] #4481: Databrowse should use pagination

2009-04-03 Thread Django
#4481: Databrowse should use pagination
+---
  Reporter:  anonymous  | Owner:  nobody
Status:  new| Milestone:
 Component:  django.contrib.databrowse  |   Version:  SVN   
Resolution: |  Keywords:
 Stage:  Design decision needed | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by parxier):

 * cc: b...@parxi.com (added)

Comment:

 is it going to be included in the official release?

-- 
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-updates@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] #9167: shutdown_message option missing in runserver.py

2009-04-03 Thread Django
#9167: shutdown_message option missing in runserver.py
+---
  Reporter:  jjackson   | Owner:  nobody
Status:  closed | Milestone:  1.1   
 Component:  django-admin.py runserver  |   Version:  1.0   
Resolution:  wontfix|  Keywords:
 Stage:  Accepted   | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  1 
Needs_better_patch:  0  |  
+---
Comment (by jjackson):

 I don't see that this is "obvious from the next commit ([5912]) that this
 bit was intended for internal use". I use this in an application I wrote
 for a demo Django Server to send to prospective clients, and it allows me
 to provide feedback that the server is shutting down. It's being used as
 shown in Ticket #8085, but it doesn't work the way it's currently
 configured. It's not as if omitting this is going to keep this hidden.

 And, it's not as if the testserver can use the 'shutdown message" option
 either: the way it is, it's just broken. If you don't want it exposed, you
 should instead remove it all, as the code doesn't even work as an
 "internal use" only, whatever that means.

 Since I use it personally, I'll just keep adding it back into my
 projects

-- 
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-updates@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] #9589: development server stops on SyntaxError or other Exceptions

2009-04-03 Thread Django
#9589: development server stops on SyntaxError or other Exceptions
+---
  Reporter:  eibaan | Owner:  nobody
Status:  new| Milestone:
 Component:  django-admin.py runserver  |   Version:  1.0   
Resolution: |  Keywords:
 Stage:  Design decision needed | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Comment (by Glenn):

 This problem is pretty annoying, but I think this fix is a bit too much of
 a hack.  I don't think it'll actually cause problems, but the attached
 patch should be a bit cleaner.  It needs testing with jython_reloader.

-- 
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-updates@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] r10380 - in django/branches/releases/1.0.X: django/db/backends/postgresql tests/regressiontests/introspection

2009-04-03 Thread noreply

Author: jacob
Date: 2009-04-03 15:53:50 -0500 (Fri, 03 Apr 2009)
New Revision: 10380

Modified:
   django/branches/releases/1.0.X/django/db/backends/postgresql/introspection.py
   django/branches/releases/1.0.X/tests/regressiontests/introspection/tests.py
Log:
[1.0.X] Fixed #9991: correctly introspect PostgreSQL 'real' types. Backport of 
r10379 from trunk.

Modified: 
django/branches/releases/1.0.X/django/db/backends/postgresql/introspection.py
===
--- 
django/branches/releases/1.0.X/django/db/backends/postgresql/introspection.py   
2009-04-03 20:52:54 UTC (rev 10379)
+++ 
django/branches/releases/1.0.X/django/db/backends/postgresql/introspection.py   
2009-04-03 20:53:50 UTC (rev 10380)
@@ -7,6 +7,7 @@
 21: 'SmallIntegerField',
 23: 'IntegerField',
 25: 'TextField',
+700: 'FloatField',
 701: 'FloatField',
 869: 'IPAddressField',
 1043: 'CharField',

Modified: 
django/branches/releases/1.0.X/tests/regressiontests/introspection/tests.py
===
--- django/branches/releases/1.0.X/tests/regressiontests/introspection/tests.py 
2009-04-03 20:52:54 UTC (rev 10379)
+++ django/branches/releases/1.0.X/tests/regressiontests/introspection/tests.py 
2009-04-03 20:53:50 UTC (rev 10380)
@@ -1,3 +1,4 @@
+from django.conf import settings
 from django.db import connection
 from django.test import TestCase
 from django.utils import functional
@@ -44,11 +45,11 @@
  
 def test_django_table_names(self):
 cursor = connection.cursor()
-cursor.execute('CREATE TABLE django_introspection_testcase_table (id 
INTEGER);');
+cursor.execute('CREATE TABLE django_introspection_test_table (id 
INTEGER);');
 tl = connection.introspection.django_table_names()
+cursor.execute("DROP TABLE django_introspection_test_table;")
 self.assert_('django_introspection_testcase_table' not in tl,
  "django_table_names() returned a non-Django table")
-cursor.execute("DROP TABLE django_introspection_testcase_table;")
 
 def test_installed_models(self):
 tables = [Article._meta.db_table, Reporter._meta.db_table]
@@ -68,20 +69,20 @@
  [f.column for f in Reporter._meta.fields])
 
 def test_get_table_description_types(self):
-cursor = connection.cursor()
+cursor = connection.cursor()
 desc = connection.introspection.get_table_description(cursor, 
Reporter._meta.db_table)
-
-# Convert the datatype into a string
-def datatype(dbtype):
-dt = connection.introspection.data_types_reverse[dbtype]
-if type(dt) is tuple:
-return dt[0]
-else:
-return dt
-
 self.assertEqual([datatype(r[1]) for r in desc],
   ['IntegerField', 'CharField', 'CharField', 
'CharField'])
 
+# Regression test for #9991 - 'real' types in postgres
+if settings.DATABASE_ENGINE.startswith('postgresql'):
+def test_postgresql_real_type(self):
+cursor = connection.cursor()
+cursor.execute("CREATE TABLE django_introspection_real_test_table 
(number REAL);") 
+desc = connection.introspection.get_table_description(cursor, 
'django_introspection_real_test_table')
+cursor.execute('DROP TABLE django_introspection_real_test_table;')
+self.assertEqual(datatype(desc[0][1]), 'FloatField')
+
 def test_get_relations(self):
 cursor = connection.cursor()
 relations = connection.introspection.get_relations(cursor, 
Article._meta.db_table)
@@ -96,4 +97,12 @@
 def test_get_indexes(self):
 cursor = connection.cursor()
 indexes = connection.introspection.get_indexes(cursor, 
Article._meta.db_table)
-self.assertEqual(indexes['reporter_id'], {'unique': False, 
'primary_key': False})
\ No newline at end of file
+self.assertEqual(indexes['reporter_id'], {'unique': False, 
'primary_key': False})
+
+def datatype(dbtype):
+"""Helper to convert a data type into a string."""
+dt = connection.introspection.data_types_reverse[dbtype]
+if type(dt) is tuple:
+return dt[0]
+else:
+return dt


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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] r10379 - in django/trunk: django/db/backends/postgresql tests/regressiontests/introspection

2009-04-03 Thread noreply

Author: jacob
Date: 2009-04-03 15:52:54 -0500 (Fri, 03 Apr 2009)
New Revision: 10379

Modified:
   django/trunk/django/db/backends/postgresql/introspection.py
   django/trunk/tests/regressiontests/introspection/tests.py
Log:
Fixed #9991: correctly introspect PostgreSQL 'real' types.

Modified: django/trunk/django/db/backends/postgresql/introspection.py
===
--- django/trunk/django/db/backends/postgresql/introspection.py 2009-04-03 
20:29:59 UTC (rev 10378)
+++ django/trunk/django/db/backends/postgresql/introspection.py 2009-04-03 
20:52:54 UTC (rev 10379)
@@ -7,6 +7,7 @@
 21: 'SmallIntegerField',
 23: 'IntegerField',
 25: 'TextField',
+700: 'FloatField',
 701: 'FloatField',
 869: 'IPAddressField',
 1043: 'CharField',

Modified: django/trunk/tests/regressiontests/introspection/tests.py
===
--- django/trunk/tests/regressiontests/introspection/tests.py   2009-04-03 
20:29:59 UTC (rev 10378)
+++ django/trunk/tests/regressiontests/introspection/tests.py   2009-04-03 
20:52:54 UTC (rev 10379)
@@ -1,3 +1,4 @@
+from django.conf import settings
 from django.db import connection
 from django.test import TestCase
 from django.utils import functional
@@ -44,11 +45,11 @@
  
 def test_django_table_names(self):
 cursor = connection.cursor()
-cursor.execute('CREATE TABLE django_introspection_testcase_table (id 
INTEGER);');
+cursor.execute('CREATE TABLE django_introspection_test_table (id 
INTEGER);');
 tl = connection.introspection.django_table_names()
+cursor.execute("DROP TABLE django_introspection_test_table;")
 self.assert_('django_introspection_testcase_table' not in tl,
  "django_table_names() returned a non-Django table")
-cursor.execute("DROP TABLE django_introspection_testcase_table;")
 
 def test_installed_models(self):
 tables = [Article._meta.db_table, Reporter._meta.db_table]
@@ -68,20 +69,20 @@
  [f.column for f in Reporter._meta.fields])
 
 def test_get_table_description_types(self):
-cursor = connection.cursor()
+cursor = connection.cursor()
 desc = connection.introspection.get_table_description(cursor, 
Reporter._meta.db_table)
-
-# Convert the datatype into a string
-def datatype(dbtype):
-dt = connection.introspection.data_types_reverse[dbtype]
-if type(dt) is tuple:
-return dt[0]
-else:
-return dt
-
 self.assertEqual([datatype(r[1]) for r in desc],
   ['IntegerField', 'CharField', 'CharField', 
'CharField'])
 
+# Regression test for #9991 - 'real' types in postgres
+if settings.DATABASE_ENGINE.startswith('postgresql'):
+def test_postgresql_real_type(self):
+cursor = connection.cursor()
+cursor.execute("CREATE TABLE django_introspection_real_test_table 
(number REAL);") 
+desc = connection.introspection.get_table_description(cursor, 
'django_introspection_real_test_table')
+cursor.execute('DROP TABLE django_introspection_real_test_table;')
+self.assertEqual(datatype(desc[0][1]), 'FloatField')
+
 def test_get_relations(self):
 cursor = connection.cursor()
 relations = connection.introspection.get_relations(cursor, 
Article._meta.db_table)
@@ -96,4 +97,12 @@
 def test_get_indexes(self):
 cursor = connection.cursor()
 indexes = connection.introspection.get_indexes(cursor, 
Article._meta.db_table)
-self.assertEqual(indexes['reporter_id'], {'unique': False, 
'primary_key': False})
\ No newline at end of file
+self.assertEqual(indexes['reporter_id'], {'unique': False, 
'primary_key': False})
+
+def datatype(dbtype):
+"""Helper to convert a data type into a string."""
+dt = connection.introspection.data_types_reverse[dbtype]
+if type(dt) is tuple:
+return dt[0]
+else:
+return dt


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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] #9167: shutdown_message option missing in runserver.py

2009-04-03 Thread Django
#9167: shutdown_message option missing in runserver.py
+---
  Reporter:  jjackson   | Owner:  nobody
Status:  closed | Milestone:  1.1   
 Component:  django-admin.py runserver  |   Version:  1.0   
Resolution:  wontfix|  Keywords:
 Stage:  Accepted   | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  1 
Needs_better_patch:  0  |  
+---
Changes (by jacob):

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

Comment:

 Looking back at [5911], it's obvious from the next commit ([5912]) that
 this bit was intended for internal use -- it's used by the `testserver`
 command. I don't see the point on making this a public API.

-- 
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-updates@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] r10378 - django/branches/releases/1.0.X/django/utils

2009-04-03 Thread noreply

Author: jacob
Date: 2009-04-03 15:29:59 -0500 (Fri, 03 Apr 2009)
New Revision: 10378

Modified:
   django/branches/releases/1.0.X/django/utils/version.py
Log:
[1.0.X] Fixed #10372: made `get_svn_revision()` more robust. Thanks, mboersma. 
Backport of r10377 from trunk.

Modified: django/branches/releases/1.0.X/django/utils/version.py
===
--- django/branches/releases/1.0.X/django/utils/version.py  2009-04-03 
20:28:23 UTC (rev 10377)
+++ django/branches/releases/1.0.X/django/utils/version.py  2009-04-03 
20:29:59 UTC (rev 10378)
@@ -19,8 +19,11 @@
 path = django.__path__[0]
 entries_path = '%s/.svn/entries' % path
 
-if os.path.exists(entries_path):
+try:
 entries = open(entries_path, 'r').read()
+except IOError:
+pass
+else:
 # Versions >= 7 of the entries file are flat text.  The first line is
 # the version number. The next set of digits after 'dir' is the 
revision.
 if re.match('(\d+)', entries):


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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] r10377 - django/trunk/django/utils

2009-04-03 Thread noreply

Author: jacob
Date: 2009-04-03 15:28:23 -0500 (Fri, 03 Apr 2009)
New Revision: 10377

Modified:
   django/trunk/django/utils/version.py
Log:
Fixed #10372: made `get_svn_revision()` more robust. Thanks, mboersma.

Modified: django/trunk/django/utils/version.py
===
--- django/trunk/django/utils/version.py2009-04-03 20:04:39 UTC (rev 
10376)
+++ django/trunk/django/utils/version.py2009-04-03 20:28:23 UTC (rev 
10377)
@@ -19,8 +19,11 @@
 path = django.__path__[0]
 entries_path = '%s/.svn/entries' % path
 
-if os.path.exists(entries_path):
+try:
 entries = open(entries_path, 'r').read()
+except IOError:
+pass
+else:
 # Versions >= 7 of the entries file are flat text.  The first line is
 # the version number. The next set of digits after 'dir' is the 
revision.
 if re.match('(\d+)', entries):


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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] #10726: Admin url reversing docs are incomplete

2009-04-03 Thread Django
#10726: Admin url reversing docs are incomplete
---+
 Reporter:  Alex   |   Owner:  nobody
   Status:  new|   Milestone:  1.1   
Component:  Documentation  | Version:  SVN   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 they're missing info on the AdminSite urls and the prefix to the names.

-- 
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-updates@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] #10408: Invalid date in DB results in "ValueError: year is out of range" in admin view when using date_hierarchy

2009-04-03 Thread Django
#10408: Invalid date in DB results in "ValueError: year is out of range" in 
admin
view when using date_hierarchy
-+--
  Reporter:  iammichael  | Owner:  nobody
Status:  closed  | Milestone:  1.1   
 Component:  Core framework  |   Version:  1.0   
Resolution:  wontfix |  Keywords:
 Stage:  Accepted| Has_patch:  1 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by jacob):

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

Comment:

 I'm going to change my mind and reject this. Django expects your data to
 be valid; if you've got invalid data, that's the problem.

-- 
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-updates@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] #10678: Confusing error when django.root has a trailing slash

2009-04-03 Thread Django
#10678: Confusing error when django.root has a trailing slash
-+--
  Reporter:  tallfred| Owner:  nobody
Status:  closed  | Milestone:  1.1   
 Component:  Core framework  |   Version:  SVN   
Resolution:  worksforme  |  Keywords:
 Stage:  Accepted| Has_patch:  1 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by jacob):

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

Comment:

 I can't reproduce this problem with or without the patch. The fact that
 "some page fail" indicates that it's not something this cut and dry. Also,
 note that the lines following guard against an empty `path_info` (line 33)
 so just striping the slash won't change that.

 I'm marking worksforme; please feel free to reopen if you find more
 information.

-- 
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-updates@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] #10696: manage.py throws away exception information

2009-04-03 Thread Django
#10696: manage.py throws away exception information
-+--
  Reporter:  Leo | Owner:  nobody
Status:  new | Milestone:
 Component:  Core framework  |   Version:  SVN   
Resolution:  |  Keywords:
 Stage:  Design decision needed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by jacob):

  * stage:  Accepted => Design decision needed

-- 
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-updates@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] #10696: manage.py throws away exception information

2009-04-03 Thread Django
#10696: manage.py throws away exception information
-+--
  Reporter:  Leo | Owner:  nobody
Status:  new | Milestone:
 Component:  Core framework  |   Version:  SVN   
Resolution:  |  Keywords:
 Stage:  Accepted| Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by jacob):

  * milestone:  1.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-updates@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] #10696: manage.py throws away exception information

2009-04-03 Thread Django
#10696: manage.py throws away exception information
-+--
  Reporter:  Leo | Owner:  nobody
Status:  new | Milestone:  1.1   
 Component:  Core framework  |   Version:  SVN   
Resolution:  |  Keywords:
 Stage:  Accepted| Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by jacob):

  * stage:  Design decision needed => Accepted

-- 
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-updates@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] r10376 - in django/branches/releases/1.0.X: django/contrib/contenttypes tests/regressiontests/generic_inline_admin

2009-04-03 Thread noreply

Author: jacob
Date: 2009-04-03 15:04:39 -0500 (Fri, 03 Apr 2009)
New Revision: 10376

Modified:
   django/branches/releases/1.0.X/django/contrib/contenttypes/generic.py
   
django/branches/releases/1.0.X/tests/regressiontests/generic_inline_admin/tests.py
Log:
[1.0.X] Fixed #10522: accept tuples in `generic_inlineformset_factor(exclude)`. 
Thanks, mk. Backport of r10375 from trunk.

Modified: django/branches/releases/1.0.X/django/contrib/contenttypes/generic.py
===
--- django/branches/releases/1.0.X/django/contrib/contenttypes/generic.py   
2009-04-03 20:03:46 UTC (rev 10375)
+++ django/branches/releases/1.0.X/django/contrib/contenttypes/generic.py   
2009-04-03 20:04:39 UTC (rev 10376)
@@ -355,6 +355,7 @@
 raise Exception("fk_name '%s' is not a ForeignKey to ContentType" % 
ct_field)
 fk_field = opts.get_field(fk_field) # let the exception propagate
 if exclude is not None:
+exclude = list(exclude)
 exclude.extend([ct_field.name, fk_field.name])
 else:
 exclude = [ct_field.name, fk_field.name]

Modified: 
django/branches/releases/1.0.X/tests/regressiontests/generic_inline_admin/tests.py
===
--- 
django/branches/releases/1.0.X/tests/regressiontests/generic_inline_admin/tests.py
  2009-04-03 20:03:46 UTC (rev 10375)
+++ 
django/branches/releases/1.0.X/tests/regressiontests/generic_inline_admin/tests.py
  2009-04-03 20:04:39 UTC (rev 10376)
@@ -2,6 +2,7 @@
 
 from django.test import TestCase
 from django.conf import settings
+from django.contrib.contenttypes.generic import generic_inlineformset_factory
 
 # local test models
 from models import Episode, Media
@@ -71,3 +72,8 @@
 }
 response = 
self.client.post('/generic_inline_admin/admin/generic_inline_admin/episode/1/', 
post_data)
 self.failUnlessEqual(response.status_code, 302) # redirect somewhere
+
+def testGenericInlineFormsetFactory(self):
+# Regression test for #10522.
+inline_formset = generic_inlineformset_factory(Media,
+exclude=('url',))


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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] r10375 - in django/trunk: django/contrib/contenttypes tests/regressiontests/generic_inline_admin

2009-04-03 Thread noreply

Author: jacob
Date: 2009-04-03 15:03:46 -0500 (Fri, 03 Apr 2009)
New Revision: 10375

Modified:
   django/trunk/django/contrib/contenttypes/generic.py
   django/trunk/tests/regressiontests/generic_inline_admin/tests.py
Log:
Fixed #10522: accept tuples in `generic_inlineformset_factor(exclude)`. Thanks, 
mk.

Modified: django/trunk/django/contrib/contenttypes/generic.py
===
--- django/trunk/django/contrib/contenttypes/generic.py 2009-04-03 19:56:30 UTC 
(rev 10374)
+++ django/trunk/django/contrib/contenttypes/generic.py 2009-04-03 20:03:46 UTC 
(rev 10375)
@@ -355,6 +355,7 @@
 raise Exception("fk_name '%s' is not a ForeignKey to ContentType" % 
ct_field)
 fk_field = opts.get_field(fk_field) # let the exception propagate
 if exclude is not None:
+exclude = list(exclude)
 exclude.extend([ct_field.name, fk_field.name])
 else:
 exclude = [ct_field.name, fk_field.name]

Modified: django/trunk/tests/regressiontests/generic_inline_admin/tests.py
===
--- django/trunk/tests/regressiontests/generic_inline_admin/tests.py
2009-04-03 19:56:30 UTC (rev 10374)
+++ django/trunk/tests/regressiontests/generic_inline_admin/tests.py
2009-04-03 20:03:46 UTC (rev 10375)
@@ -2,6 +2,7 @@
 
 from django.test import TestCase
 from django.conf import settings
+from django.contrib.contenttypes.generic import generic_inlineformset_factory
 
 # local test models
 from models import Episode, Media
@@ -74,3 +75,8 @@
 url = '/generic_inline_admin/admin/generic_inline_admin/episode/%d/' % 
self.episode_pk
 response = self.client.post(url, post_data)
 self.failUnlessEqual(response.status_code, 302) # redirect somewhere
+
+def testGenericInlineFormsetFactory(self):
+# Regression test for #10522.
+inline_formset = generic_inlineformset_factory(Media,
+exclude=('url',))


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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] r10374 - in django/branches/releases/1.0.X: django/contrib/contenttypes tests/regressiontests tests/regressiontests/generic_relations_regress

2009-04-03 Thread noreply

Author: jacob
Date: 2009-04-03 14:56:30 -0500 (Fri, 03 Apr 2009)
New Revision: 10374

Added:
   
django/branches/releases/1.0.X/tests/regressiontests/generic_relations_regress/
   
django/branches/releases/1.0.X/tests/regressiontests/generic_relations_regress/__init__.py
   
django/branches/releases/1.0.X/tests/regressiontests/generic_relations_regress/models.py
   
django/branches/releases/1.0.X/tests/regressiontests/generic_relations_regress/tests.py
Modified:
   django/branches/releases/1.0.X/django/contrib/contenttypes/generic.py
Log:
[1.0.X] Fixed #9546: GenericRelations inherited from base models no longer 
query using the wrong content type. Backport of r10373 from trunk.

Modified: django/branches/releases/1.0.X/django/contrib/contenttypes/generic.py
===
--- django/branches/releases/1.0.X/django/contrib/contenttypes/generic.py   
2009-04-03 19:52:14 UTC (rev 10373)
+++ django/branches/releases/1.0.X/django/contrib/contenttypes/generic.py   
2009-04-03 19:56:30 UTC (rev 10374)
@@ -193,9 +193,9 @@
 rel_model = self.field.rel.to
 superclass = rel_model._default_manager.__class__
 RelatedManager = create_generic_related_manager(superclass)
-
+
 qn = connection.ops.quote_name
-
+
 manager = RelatedManager(
 model = rel_model,
 instance = instance,
@@ -203,7 +203,7 @@
 join_table = qn(self.field.m2m_db_table()),
 source_col_name = qn(self.field.m2m_column_name()),
 target_col_name = qn(self.field.m2m_reverse_name()),
-content_type = ContentType.objects.get_for_model(self.field.model),
+content_type = ContentType.objects.get_for_model(instance),
 content_type_field_name = self.field.content_type_field_name,
 object_id_field_name = self.field.object_id_field_name
 )

Added: 
django/branches/releases/1.0.X/tests/regressiontests/generic_relations_regress/__init__.py
===

Added: 
django/branches/releases/1.0.X/tests/regressiontests/generic_relations_regress/models.py
===
--- 
django/branches/releases/1.0.X/tests/regressiontests/generic_relations_regress/models.py
(rev 0)
+++ 
django/branches/releases/1.0.X/tests/regressiontests/generic_relations_regress/models.py
2009-04-03 19:56:30 UTC (rev 10374)
@@ -0,0 +1,22 @@
+from django.db import models
+from django.contrib.contenttypes import generic
+from django.contrib.contenttypes.models import ContentType
+
+class Link(models.Model):
+content_type = models.ForeignKey(ContentType)
+object_id = models.PositiveIntegerField()
+content_object = generic.GenericForeignKey()
+
+def __unicode__(self):
+return "Link to %s id=%s" % (self.content_type, self.object_id)
+
+class Place(models.Model):
+name = models.CharField(max_length=100)
+links = generic.GenericRelation(Link)
+
+def __unicode__(self):
+return "Place: %s" % self.name
+
+class Restaurant(Place): 
+def __unicode__(self):
+return "Restaurant: %s" % self.name
\ No newline at end of file

Added: 
django/branches/releases/1.0.X/tests/regressiontests/generic_relations_regress/tests.py
===
--- 
django/branches/releases/1.0.X/tests/regressiontests/generic_relations_regress/tests.py
 (rev 0)
+++ 
django/branches/releases/1.0.X/tests/regressiontests/generic_relations_regress/tests.py
 2009-04-03 19:56:30 UTC (rev 10374)
@@ -0,0 +1,19 @@
+from django.test import TestCase
+from django.contrib.contenttypes.models import ContentType
+from models import Link, Place, Restaurant
+
+class GenericRelationTests(TestCase):
+
+def test_inherited_models_content_type(self):
+"""
+Test that GenericRelations on inherited classes use the correct content
+type.
+"""
+
+p = Place.objects.create(name="South Park")
+r = Restaurant.objects.create(name="Chubby's")
+l1 = Link.objects.create(content_object=p)
+l2 = Link.objects.create(content_object=r)
+self.assertEqual(list(p.links.all()), [l1])
+self.assertEqual(list(r.links.all()), [l2])
+
\ No newline at end of file


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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] r10373 - in django/trunk: django/contrib/contenttypes tests/regressiontests tests/regressiontests/generic_relations_regress

2009-04-03 Thread noreply

Author: jacob
Date: 2009-04-03 14:52:14 -0500 (Fri, 03 Apr 2009)
New Revision: 10373

Added:
   django/trunk/tests/regressiontests/generic_relations_regress/
   django/trunk/tests/regressiontests/generic_relations_regress/__init__.py
   django/trunk/tests/regressiontests/generic_relations_regress/models.py
   django/trunk/tests/regressiontests/generic_relations_regress/tests.py
Modified:
   django/trunk/django/contrib/contenttypes/generic.py
Log:
Fixed #9546: GenericRelations inherited from base models no longer query using 
the wrong content type.

Modified: django/trunk/django/contrib/contenttypes/generic.py
===
--- django/trunk/django/contrib/contenttypes/generic.py 2009-04-03 18:37:43 UTC 
(rev 10372)
+++ django/trunk/django/contrib/contenttypes/generic.py 2009-04-03 19:52:14 UTC 
(rev 10373)
@@ -193,9 +193,9 @@
 rel_model = self.field.rel.to
 superclass = rel_model._default_manager.__class__
 RelatedManager = create_generic_related_manager(superclass)
-
+
 qn = connection.ops.quote_name
-
+
 manager = RelatedManager(
 model = rel_model,
 instance = instance,
@@ -203,7 +203,7 @@
 join_table = qn(self.field.m2m_db_table()),
 source_col_name = qn(self.field.m2m_column_name()),
 target_col_name = qn(self.field.m2m_reverse_name()),
-content_type = ContentType.objects.get_for_model(self.field.model),
+content_type = ContentType.objects.get_for_model(instance),
 content_type_field_name = self.field.content_type_field_name,
 object_id_field_name = self.field.object_id_field_name
 )

Added: django/trunk/tests/regressiontests/generic_relations_regress/__init__.py
===

Added: django/trunk/tests/regressiontests/generic_relations_regress/models.py
===
--- django/trunk/tests/regressiontests/generic_relations_regress/models.py  
(rev 0)
+++ django/trunk/tests/regressiontests/generic_relations_regress/models.py  
2009-04-03 19:52:14 UTC (rev 10373)
@@ -0,0 +1,22 @@
+from django.db import models
+from django.contrib.contenttypes import generic
+from django.contrib.contenttypes.models import ContentType
+
+class Link(models.Model):
+content_type = models.ForeignKey(ContentType)
+object_id = models.PositiveIntegerField()
+content_object = generic.GenericForeignKey()
+
+def __unicode__(self):
+return "Link to %s id=%s" % (self.content_type, self.object_id)
+
+class Place(models.Model):
+name = models.CharField(max_length=100)
+links = generic.GenericRelation(Link)
+
+def __unicode__(self):
+return "Place: %s" % self.name
+
+class Restaurant(Place): 
+def __unicode__(self):
+return "Restaurant: %s" % self.name
\ No newline at end of file

Added: django/trunk/tests/regressiontests/generic_relations_regress/tests.py
===
--- django/trunk/tests/regressiontests/generic_relations_regress/tests.py   
(rev 0)
+++ django/trunk/tests/regressiontests/generic_relations_regress/tests.py   
2009-04-03 19:52:14 UTC (rev 10373)
@@ -0,0 +1,19 @@
+from django.test import TestCase
+from django.contrib.contenttypes.models import ContentType
+from models import Link, Place, Restaurant
+
+class GenericRelationTests(TestCase):
+
+def test_inherited_models_content_type(self):
+"""
+Test that GenericRelations on inherited classes use the correct content
+type.
+"""
+
+p = Place.objects.create(name="South Park")
+r = Restaurant.objects.create(name="Chubby's")
+l1 = Link.objects.create(content_object=p)
+l2 = Link.objects.create(content_object=r)
+self.assertEqual(list(p.links.all()), [l1])
+self.assertEqual(list(r.links.all()), [l2])
+
\ No newline at end of file


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@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] #10725: Autoreloader hides signal exits from child

2009-04-03 Thread Django
#10725: Autoreloader hides signal exits from child
+---
 Reporter:  Glenn   |   Owner:  nobody
   Status:  new |   Milestone:
Component:  Core framework  | Version:  SVN   
 Keywords:  |   Stage:  Unreviewed
Has_patch:  1   |  
+---
 When the autoreloader is active, if the child (main) Python process exits
 with a signal, the signal is neither passed to the real parent nor
 displayed at all: the server silently exits.  This makes interpreter
 crashes confusing until you realize what's going on.

-- 
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-updates@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] #10122: setting locales for a single HTTP context

2009-04-03 Thread Django
#10122: setting locales for a single HTTP context
+---
  Reporter:  mathijs| Owner:  jacob 

Status:  closed | Milestone:  1.1   

 Component:  Documentation  |   Version:  1.0   

Resolution:  wontfix|  Keywords:  internationalisation, 
context, rendering, template, locale
 Stage:  Accepted   | Has_patch:  0 

Needs_docs:  1  |   Needs_tests:  0 

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

  * status:  assigned => closed
  * resolution:  => wontfix

Comment:

 This is a pretty specific need, so it's not of interest to most doc
 readers. I"d suggest posting this on djangosnippets.org; that's a better
 place for it.

-- 
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-updates@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] r10372 - in django/branches/releases/1.0.X: django/utils docs/_static docs/howto docs/howto/deployment docs/intro docs/misc docs/obsolete docs/obsolete/_images docs/ref docs/ref/contrib do

2009-04-03 Thread noreply

Author: jacob
Date: 2009-04-03 13:37:43 -0500 (Fri, 03 Apr 2009)
New Revision: 10372

Added:
   django/branches/releases/1.0.X/docs/_static/docicons-behindscenes.png
   django/branches/releases/1.0.X/docs/_static/docicons-note.png
   django/branches/releases/1.0.X/docs/_static/docicons-philosophy.png
   django/branches/releases/1.0.X/docs/obsolete/_images/formrow.png
   django/branches/releases/1.0.X/docs/obsolete/_images/module.png
   django/branches/releases/1.0.X/docs/obsolete/_images/objecttools_01.png
   django/branches/releases/1.0.X/docs/obsolete/_images/objecttools_02.png
   django/branches/releases/1.0.X/docs/ref/contrib/comments/models.txt
Removed:
   django/branches/releases/1.0.X/docs/_static/docicons-behindscenes.gif
   django/branches/releases/1.0.X/docs/_static/docicons-note.gif
   django/branches/releases/1.0.X/docs/_static/docicons-philosophy.gif
   django/branches/releases/1.0.X/docs/obsolete/_images/formrow.gif
   django/branches/releases/1.0.X/docs/obsolete/_images/module.gif
   django/branches/releases/1.0.X/docs/obsolete/_images/objecttools_01.gif
   django/branches/releases/1.0.X/docs/obsolete/_images/objecttools_02.gif
Modified:
   django/branches/releases/1.0.X/django/utils/html.py
   django/branches/releases/1.0.X/docs/_static/djangodocs.css
   django/branches/releases/1.0.X/docs/howto/custom-file-storage.txt
   django/branches/releases/1.0.X/docs/howto/deployment/modpython.txt
   django/branches/releases/1.0.X/docs/howto/initial-data.txt
   django/branches/releases/1.0.X/docs/howto/static-files.txt
   django/branches/releases/1.0.X/docs/intro/tutorial01.txt
   django/branches/releases/1.0.X/docs/intro/tutorial03.txt
   django/branches/releases/1.0.X/docs/intro/tutorial04.txt
   django/branches/releases/1.0.X/docs/misc/distributions.txt
   django/branches/releases/1.0.X/docs/obsolete/admin-css.txt
   django/branches/releases/1.0.X/docs/ref/contrib/admin.txt
   django/branches/releases/1.0.X/docs/ref/contrib/comments/index.txt
   django/branches/releases/1.0.X/docs/ref/contrib/flatpages.txt
   django/branches/releases/1.0.X/docs/ref/contrib/syndication.txt
   django/branches/releases/1.0.X/docs/ref/databases.txt
   django/branches/releases/1.0.X/docs/ref/django-admin.txt
   django/branches/releases/1.0.X/docs/ref/forms/api.txt
   django/branches/releases/1.0.X/docs/ref/forms/fields.txt
   django/branches/releases/1.0.X/docs/ref/forms/widgets.txt
   django/branches/releases/1.0.X/docs/ref/models/fields.txt
   django/branches/releases/1.0.X/docs/ref/models/instances.txt
   django/branches/releases/1.0.X/docs/ref/models/relations.txt
   django/branches/releases/1.0.X/docs/ref/templates/api.txt
   django/branches/releases/1.0.X/docs/ref/unicode.txt
   django/branches/releases/1.0.X/docs/releases/1.0-porting-guide.txt
   django/branches/releases/1.0.X/docs/topics/auth.txt
   django/branches/releases/1.0.X/docs/topics/cache.txt
   django/branches/releases/1.0.X/docs/topics/db/models.txt
   django/branches/releases/1.0.X/docs/topics/db/queries.txt
   django/branches/releases/1.0.X/docs/topics/forms/formsets.txt
   django/branches/releases/1.0.X/docs/topics/forms/modelforms.txt
   django/branches/releases/1.0.X/docs/topics/http/middleware.txt
   django/branches/releases/1.0.X/docs/topics/serialization.txt
   django/branches/releases/1.0.X/docs/topics/testing.txt
Log:
[1.0.X] Fixed a whole bunch of small docs typos, errors, and ommissions. 
Backport of the parts of r10371 that apply to the 1.0 docs.

Modified: django/branches/releases/1.0.X/django/utils/html.py
===
--- django/branches/releases/1.0.X/django/utils/html.py 2009-04-03 18:30:54 UTC 
(rev 10371)
+++ django/branches/releases/1.0.X/django/utils/html.py 2009-04-03 18:37:43 UTC 
(rev 10372)
@@ -28,7 +28,9 @@
 del x # Temporary variable
 
 def escape(html):
-"""Returns the given HTML with ampersands, quotes and carets encoded."""
+"""
+Returns the given HTML with ampersands, quotes and angle brackets encoded.
+"""
 return mark_safe(force_unicode(html).replace('&', '&').replace('<', 
'<').replace('>', '>').replace('"', '"').replace("'", '''))
 escape = allow_lazy(escape, unicode)
 

Modified: django/branches/releases/1.0.X/docs/_static/djangodocs.css
===
--- django/branches/releases/1.0.X/docs/_static/djangodocs.css  2009-04-03 
18:30:54 UTC (rev 10371)
+++ django/branches/releases/1.0.X/docs/_static/djangodocs.css  2009-04-03 
18:37:43 UTC (rev 10372)
@@ -103,9 +103,9 @@
 .note, .admonition { padding:.8em 1em .8em; margin: 1em 0; border:1px solid 
#94da3a; }
 .admonition-title { font-weight:bold; margin-top:0 !important; margin-bottom:0 
!important;}
 .admonition .last { margin-bottom:0 !important; }
-.note, .admonition { padding-left:65px; background:url(docicons-note.gif) .8em 
.8em no-repeat;}
-div.admonition-philosophy { padding-left:65px; 
background:url(docicons-philosophy.gif) .8em

Re: [Django] #10528: Admin documentation doesn't mention reverse names

2009-04-03 Thread Django
#10528: Admin documentation doesn't mention reverse names
+---
  Reporter:  Leo| Owner:  jacob
Status:  closed | Milestone:  1.1  
 Component:  Documentation  |   Version:  SVN  
Resolution:  fixed  |  Keywords:   
 Stage:  Accepted   | Has_patch:  0
Needs_docs:  0  |   Needs_tests:  0
Needs_better_patch:  0  |  
+---
Changes (by jacob):

  * status:  assigned => closed
  * resolution:  => fixed

Comment:

 Fixed in [10371].

-- 
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-updates@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] r10371 - in django/trunk: django/utils docs/_static docs/howto docs/howto/deployment docs/intro docs/misc docs/obsolete docs/obsolete/_images docs/ref docs/ref/contrib docs/ref/contrib/adm

2009-04-03 Thread noreply

Author: jacob
Date: 2009-04-03 13:30:54 -0500 (Fri, 03 Apr 2009)
New Revision: 10371

Added:
   django/trunk/docs/_static/docicons-behindscenes.png
   django/trunk/docs/_static/docicons-note.png
   django/trunk/docs/_static/docicons-philosophy.png
   django/trunk/docs/obsolete/_images/formrow.png
   django/trunk/docs/obsolete/_images/module.png
   django/trunk/docs/obsolete/_images/objecttools_01.png
   django/trunk/docs/obsolete/_images/objecttools_02.png
   django/trunk/docs/ref/contrib/comments/models.txt
Removed:
   django/trunk/docs/_static/docicons-behindscenes.gif
   django/trunk/docs/_static/docicons-note.gif
   django/trunk/docs/_static/docicons-philosophy.gif
   django/trunk/docs/obsolete/_images/formrow.gif
   django/trunk/docs/obsolete/_images/module.gif
   django/trunk/docs/obsolete/_images/objecttools_01.gif
   django/trunk/docs/obsolete/_images/objecttools_02.gif
Modified:
   django/trunk/django/utils/html.py
   django/trunk/docs/_static/djangodocs.css
   django/trunk/docs/howto/custom-file-storage.txt
   django/trunk/docs/howto/deployment/modpython.txt
   django/trunk/docs/howto/initial-data.txt
   django/trunk/docs/howto/static-files.txt
   django/trunk/docs/intro/tutorial01.txt
   django/trunk/docs/intro/tutorial03.txt
   django/trunk/docs/intro/tutorial04.txt
   django/trunk/docs/misc/distributions.txt
   django/trunk/docs/obsolete/admin-css.txt
   django/trunk/docs/ref/contrib/admin/index.txt
   django/trunk/docs/ref/contrib/comments/index.txt
   django/trunk/docs/ref/contrib/flatpages.txt
   django/trunk/docs/ref/contrib/syndication.txt
   django/trunk/docs/ref/databases.txt
   django/trunk/docs/ref/django-admin.txt
   django/trunk/docs/ref/forms/api.txt
   django/trunk/docs/ref/forms/fields.txt
   django/trunk/docs/ref/forms/widgets.txt
   django/trunk/docs/ref/models/fields.txt
   django/trunk/docs/ref/models/instances.txt
   django/trunk/docs/ref/models/relations.txt
   django/trunk/docs/ref/templates/api.txt
   django/trunk/docs/ref/unicode.txt
   django/trunk/docs/releases/1.0-porting-guide.txt
   django/trunk/docs/topics/auth.txt
   django/trunk/docs/topics/cache.txt
   django/trunk/docs/topics/db/models.txt
   django/trunk/docs/topics/db/queries.txt
   django/trunk/docs/topics/forms/formsets.txt
   django/trunk/docs/topics/forms/modelforms.txt
   django/trunk/docs/topics/http/middleware.txt
   django/trunk/docs/topics/serialization.txt
   django/trunk/docs/topics/testing.txt
Log:
Fixed a whole bunch of small docs typos, errors, and ommissions.

Fixes #8358, #8396, #8724, #9043, #9128, #9247, #9267, #9267, #9375, #9409, 
#9414, #9416, #9446, #9454, #9464, #9503, #9518, #9533, #9657, #9658, #9683, 
#9733, #9771, #9835, #9836, #9837, #9897, #9906, #9912, #9945, #9986, #9992, 
#10055, #10084, #10091, #10145, #10245, #10257, #10309, #10358, #10359, #10424, 
#10426, #10508, #10531, #10551, #10635, #10637, #10656, #10658, #10690, #10699, 
#19528.

Thanks to all the respective authors of those tickets.

Modified: django/trunk/django/utils/html.py
===
--- django/trunk/django/utils/html.py   2009-04-03 06:59:34 UTC (rev 10370)
+++ django/trunk/django/utils/html.py   2009-04-03 18:30:54 UTC (rev 10371)
@@ -28,7 +28,9 @@
 del x # Temporary variable
 
 def escape(html):
-"""Returns the given HTML with ampersands, quotes and carets encoded."""
+"""
+Returns the given HTML with ampersands, quotes and angle brackets encoded.
+"""
 return mark_safe(force_unicode(html).replace('&', '&').replace('<', 
'<').replace('>', '>').replace('"', '"').replace("'", '''))
 escape = allow_lazy(escape, unicode)
 

Modified: django/trunk/docs/_static/djangodocs.css
===
--- django/trunk/docs/_static/djangodocs.css2009-04-03 06:59:34 UTC (rev 
10370)
+++ django/trunk/docs/_static/djangodocs.css2009-04-03 18:30:54 UTC (rev 
10371)
@@ -103,9 +103,9 @@
 .note, .admonition { padding:.8em 1em .8em; margin: 1em 0; border:1px solid 
#94da3a; }
 .admonition-title { font-weight:bold; margin-top:0 !important; margin-bottom:0 
!important;}
 .admonition .last { margin-bottom:0 !important; }
-.note, .admonition { padding-left:65px; background:url(docicons-note.gif) .8em 
.8em no-repeat;}
-div.admonition-philosophy { padding-left:65px; 
background:url(docicons-philosophy.gif) .8em .8em no-repeat;}
-div.admonition-behind-the-scenes { padding-left:65px; 
background:url(docicons-behindscenes.gif) .8em .8em no-repeat;}
+.note, .admonition { padding-left:65px; background:url(docicons-note.png) .8em 
.8em no-repeat;}
+div.admonition-philosophy { padding-left:65px; 
background:url(docicons-philosophy.png) .8em .8em no-repeat;}
+div.admonition-behind-the-scenes { padding-left:65px; 
background:url(docicons-behindscenes.png) .8em .8em no-repeat;}
 
 /*** versoinadded/changes ***/
 div.versionadded, div.versionchanged {  }

Deleted: django/trunk/docs/_static/docicons-behindscenes.gif

Re: [Django] #10724: Derived quries used in extra(tables=[]) should not be escaped

2009-04-03 Thread Django
#10724: Derived quries used in extra(tables=[]) should not be escaped
+---
  Reporter:  bendavis78 | Owner:  nobody
Status:  closed | Milestone:
 Component:  Uncategorized  |   Version:  SVN   
Resolution:  wontfix|  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by Alex):

  * status:  new => closed
  * needs_better_patch:  => 0
  * resolution:  => wontfix
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 Django is not bulding a SQL parser, we are not going to try to detect when
 you have a subquery there.

-- 
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-updates@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] #10724: Derived quries used in extra(tables=[]) should not be escaped

2009-04-03 Thread Django
#10724: Derived quries used in extra(tables=[]) should not be escaped
---+
 Reporter:  bendavis78 |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Uncategorized  | Version:  SVN   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 example:
 {{{
 #!python
 subquery_earned = "(SELECT user_id, SUM(points) AS points FROM
 rewards_userpointearning) AS points_earned"
 subquery_spent = "(SELECT user_id, SUM(points) AS points FROM
 rewards_order) AS points_spent"
 condition = "points_earned.user_id = auth_user.id AND points_spent.user_id
 = auth_user.id"  #join
 select = {'points_balance' : 'points_earned.points - points_spent.points'}
 q = User.objects.get_query_set().extra(select=select,
 tables=[subquery_earned, subquery_spent], where=[condition])
 q = q.order_by('-points_balance')
 }}}
 The resulting query is:
 {{{
 #!sql
 SELECT (points_earned.points - points_spent.points) AS `points_balance`,
 `auth_user`.`id`
 FROM
   `auth_user` ,
   `(SELECT user_id, SUM(points) AS points FROM rewards_userpointearning)
 AS points_earned` ,
   `(SELECT user_id, SUM(points) AS points FROM rewards_order) AS
 points_spent`
 WHERE points_earned.user_id = auth_user.id AND points_spent.user_id =
 auth_user.id
 ORDER BY `points_balance` DESC
 }}}
 In MySQL, this results in the error:
 {{{
 ProgrammingError: (1103, "Incorrect table name '(SELECT user_id,
 SUM(points) AS points FROM rewards_userpointearning) AS points_earned'")
 }}}

 Django should detect whether a table that's been passed through extra()'s
 tables parameter is a real table or not,  and only add backticks when
 necessary.

-- 
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-updates@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] #10723: ORM exclute strange

2009-04-03 Thread Django
#10723: ORM exclute strange
--+-
 Reporter:  anonymous |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  Database layer (models, ORM)  | Version:  SVN   
 Keywords:|   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 My models is:
 {{{
 class Type(models.Model):
 id = models.AutoField(primary_key=True)
 slug = models.SlugField(unique=True, max_length=10)
 title = models.CharField(max_length=20)
 weight = models.SmallIntegerField(default=0, db_index=True)

 class Active(models.Model):
 post = models.ForeignKey(Post, related_name='activeposts')
 rubrica = models.ForeignKey(Rubrica, related_name='activeposts')
 type = models.ForeignKey(Type, related_name='activeposts')
 user_id = models.PositiveIntegerField()
 pub_date = models.DateTimeField(default=datetime.now)
 }}}


 {{{
 Type.objects.filter(Q(activeposts__rubrica__pk=112) &
 
Q(activeposts__user_id__in=[1,2,3])).annotate(count=Count('activeposts')).query.as_sql()
 }}}

 Result is correct:

 {{{
 ('SELECT `doska_type`.`id`, `doska_type`.`slug`, `doska_type`.`weight`,
 COUNT(`doska_active_new`.`id`) AS `count` FROM `doska_type` LEFT OUTER
 JOIN `doska_active_new` ON (`doska_type`.`id` =
 `doska_active_new`.`type_id`) WHERE (`doska_active_new`.`rubrica_id` = %s
 AND `doska_active_new`.`user_id` IN (%s, %s, %s)) GROUP BY
 `doska_type`.`id` ORDER BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
 }}}
 But
 {{{
 Type.objects.filter(Q(activeposts__rubrica__pk=112) &
 
~Q(activeposts__user_id__in=[1,2,3])).annotate(count=Count('activeposts')).query.as_sql()
 }}}

 Result is not correct:

 {{{
 ('SELECT `doska_type`.`id`, `doska_type`.`slug`, `doska_type`.`weight`,
 COUNT(`doska_active_new`.`id`) AS `count` FROM `doska_type` LEFT OUTER
 JOIN `doska_active_new` ON (`doska_type`.`id` =
 `doska_active_new`.`type_id`) WHERE (`doska_active_new`.`rubrica_id` = %s
 AND NOT (`doska_type`.`id` IN (SELECT U1.`type_id` FROM `doska_active_new`
 U1 WHERE U1.`user_id` IN (%s, %s, %s GROUP BY `doska_type`.`id` ORDER
 BY `doska_type`.`weight` ASC', (112, 1, 2, 3))
 }}}

-- 
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-updates@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] #10721: Django not update field when I use arrays[] for select object:

2009-04-03 Thread Django
#10721: Django not update field when I use arrays[] for select object:
---+
  Reporter:  moize...@gmail.com| Owner:  nobody
Status:  closed| Milestone:
 Component:  Database layer (models, ORM)  |   Version:  1.0   
Resolution:  invalid   |  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Comment (by anonymous):

 Ok, it worked!!, thank's!

-- 
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-updates@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] #10722: Changelist view does not use select_related() on a nullable foreign key

2009-04-03 Thread Django
#10722: Changelist view does not use select_related() on a nullable foreign key
---+
  Reporter:  mrts  | Owner:  nobody
Status:  closed| Milestone:
 Component:  django.contrib.admin  |   Version:  SVN   
Resolution:  invalid   |  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by kmtracey):

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

Comment:

 Admin doesn't introspect the model and decide not to use select_related()
 if null=True on a !ForeignKey.  Rather, select_related() itself does not
 follow null=True !ForeignKeys, as documented:
 http://docs.djangoproject.com/en/dev/ref/models/querysets/#select-related

 "Note that, by default, select_related() does not follow foreign keys that
 have null=True."

 This strikes me as another case where if you want to control the queries
 the admin is going to issue to this level of detail, you'll need to
 specify the !ModelAdmin queryset() 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-updates@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] #10721: Django not update field when I use arrays[] for select object:

2009-04-03 Thread Django
#10721: Django not update field when I use arrays[] for select object:
---+
  Reporter:  moize...@gmail.com| Owner:  nobody
Status:  closed| Milestone:
 Component:  Database layer (models, ORM)  |   Version:  1.0   
Resolution:  invalid   |  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by kmtracey):

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

Old description:

> Django not update field when I use arrays[] for select object:
>
> Itensvar = Itens.objects.all()
> Itensvar[0].desc = 'Test'
> Itensvar[0].save()
>
> #django not execute update in database

New description:

 Django not update field when I use arrays[] for select object:

 {{{
 Itensvar = Itens.objects.all()
 Itensvar[0].desc = 'Test'
 Itensvar[0].save()

 #django not execute update in database
 }}}

Comment:

 Reformatted description -- please use preview to ensure your tickets are
 readable before submitting them.

 Actually the `Itensvar[0].save()` will issue a database update, the
 problem is it will call save() on an newly-retrieved-from-the-database
 object, not the one you retrieved and change the desc on in the previous
 line.  There is no caching done when you access a queryset by indexing
 like this.  If you look at the doc here:
 http://docs.djangoproject.com/en/dev/topics/db/queries/#limiting-querysets
 and replace the indexing notation with what its rough equivalent is:

 {{{
 Itensvar[0:1].get().desc = 'Test'
 Itensvar[0:1].get().save()
 }}}

 you can see the problem.  The 2nd line isn't operating on the same object
 as the first one changed, it's calling save() on a new copy retrieved from
 the database.  You need to write this as:

 {{{
 x = Itensvar[0]
 x.desc = 'Test'
 x.save()
 }}}

-- 
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-updates@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] #10722: Changelist view does not use select_related() on a nullable foreign key

2009-04-03 Thread Django
#10722: Changelist view does not use select_related() on a nullable foreign key
---+
  Reporter:  mrts  | Owner:  nobody
Status:  new   | Milestone:
 Component:  django.contrib.admin  |   Version:  SVN   
Resolution:|  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by mrts):

  * needs_better_patch:  => 0
  * component:  Uncategorized => django.contrib.admin
  * 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-updates@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] #10722: Changelist view does not use select_related() on a nullable foreign key

2009-04-03 Thread Django
#10722: Changelist view does not use select_related() on a nullable foreign key
---+
 Reporter:  mrts   |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Uncategorized  | Version:  SVN   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 Given the following `models.py`:

 {{{
 from django.db import models

 class Base(models.Model):
 name = models.CharField(max_length=10)
 lots_of_text = models.TextField()

 class Meta:
 abstract = True

 def __unicode__(self):
 return self.name

 class A(Base):
 a_field = models.CharField(max_length=10)

 class B(Base):
 b_field = models.CharField(max_length=10)

 class C(Base):
 a = models.ForeignKey(A)
 b = models.ForeignKey(B)
 is_published = models.BooleanField()
 }}}

 and the following `admin.py`:

 {{{
 from django.contrib import admin
 from improve_admin.models import A, B, C

 class CAdmin(admin.ModelAdmin):
 list_display = ('name', 'a', 'b', 'is_published')

 admin.site.register(A)
 admin.site.register(B)
 admin.site.register(C, CAdmin)
 }}}

 `select_related()` is used as documented in
 http://docs.djangoproject.com/en/dev/ref/contrib/admin/#list-select-
 related , resulting in the following query:

 {{{
 SELECT
 "improve_admin_c"."id", "improve_admin_c"."name",
 "improve_admin_c"."lots_of_text", "improve_admin_c"."a_id",
 "improve_admin_c"."b_id", "improve_admin_c"."is_published",
 "improve_admin_a"."id", "improve_admin_a"."name",
 "improve_admin_a"."lots_of_text", "improve_admin_a"."a_field",
 "improve_admin_b"."id", "improve_admin_b"."name",
 "improve_admin_b"."lots_of_text", "improve_admin_b"."b_field"
 FROM
 "improve_admin_c"
 INNER JOIN "improve_admin_a" ON ("improve_admin_c"."a_id" =
 "improve_admin_a"."id")
 INNER JOIN "improve_admin_b" ON ("improve_admin_c"."b_id" =
 "improve_admin_b"."id")
 ORDER BY
 "improve_admin_c"."id" DESC
 }}}

 

 Setting one foreign key field to be nullable:
 {{{
 # diff between the original and new models.py
  class C(Base):
 -a = models.ForeignKey(A)
 +a = models.ForeignKey(A, blank=True, null=True)
  b = models.ForeignKey(B)
 }}}

 results in the following SQL:
 {{{
 SELECT
 "improve_admin_c"."id", "improve_admin_c"."name",
 "improve_admin_c"."lots_of_text", "improve_admin_c"."a_id",
 "improve_admin_c"."b_id", "improve_admin_c"."is_published",
 "improve_admin_b"."id", "improve_admin_b"."name",
 "improve_admin_b"."lots_of_text", "improve_admin_b"."b_field"
 FROM
 "improve_admin_c"
 INNER JOIN "improve_admin_b" ON ("improve_admin_c"."b_id" =
 "improve_admin_b"."id")
 ORDER BY
 "improve_admin_c"."id" DESC
 }}}

 and additional `n` queries for each of the referred `a` fields:

 {{{
 SELECT
 "improve_admin_a"."id", "improve_admin_a"."name",
 "improve_admin_a"."lots_of_text", "improve_admin_a"."a_field"
 FROM
 "improve_admin_a"
 WHERE
 "improve_admin_a"."id" = 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-updates@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] #10721: Django not update field when I use arrays[] for select object:

2009-04-03 Thread Django
#10721: Django not update field when I use arrays[] for select object:
---+
  Reporter:  moize...@gmail.com| Owner:  nobody
Status:  new   | Milestone:
 Component:  Database layer (models, ORM)  |   Version:  1.0   
Resolution:|  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by anonymous):

  * 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-updates@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] #7609: PositiveIntegerField and co have a misleading name

2009-04-03 Thread Django
#7609: PositiveIntegerField and co have a misleading name
-+--
  Reporter:  Gergely Kontra   |  
   Owner:  programmerq
Status:  assigned| 
Milestone: 
 Component:  Forms   |  
 Version:  SVN
Resolution:  |  
Keywords:  name convention, rename
 Stage:  Design decision needed  | 
Has_patch:  0  
Needs_docs:  0   |   
Needs_tests:  0  
Needs_better_patch:  0   |  
-+--
Comment (by kmtracey):

 #10719 marked as a dup.  I favor its recommendation to explicitly note in
 the docs these fields include zero as valid input.  I don't think we need
 yet more names for the same thing and it would be backwards-incompatible
 at this point to start disallowing zero for these fields.

-- 
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-updates@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] #10721: Django not update field when I use arrays[] for select object:

2009-04-03 Thread Django
#10721: Django not update field when I use arrays[] for select object:
--+-
 Reporter:  moize...@gmail.com|   Owner:  nobody
   Status:  new   |   Milestone:
Component:  Database layer (models, ORM)  | Version:  1.0   
 Keywords:|   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 Django not update field when I use arrays[] for select object:

 Itensvar = Itens.objects.all()
 Itensvar[0].desc = 'Test'
 Itensvar[0].save()

 #django not execute update in database

-- 
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-updates@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] #10719: zero and PositiveIntegerField/PositiveSmallIntegerField

2009-04-03 Thread Django
#10719: zero and PositiveIntegerField/PositiveSmallIntegerField
+---
  Reporter:  while0pass | Owner:  nobody
Status:  closed | Milestone:
 Component:  Documentation  |   Version:  1.0   
Resolution:  duplicate  |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by kmtracey):

  * status:  new => closed
  * needs_better_patch:  => 0
  * resolution:  => duplicate
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 #7609 is already open on 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-updates@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] #10712: ModelAdmin.queryset() is undocumented.

2009-04-03 Thread Django
#10712: ModelAdmin.queryset() is undocumented.
+---
  Reporter:  mrts   | Owner:  nobody
Status:  new| Milestone:  1.1   
 Component:  Documentation  |   Version:  1.0   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  1  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Comment (by mrts):

 Ideally, the following use cases would be documented:
  * show only objects owned by the logged-in user (by James):
  {{{
 def queryset(self, request):
 if request.user.is_superuser:
 return Entry.objects.all()
 return Entry.objects.filter(author=request.user)
  }}}
  * defer large fields that would otherwise slow down the changelist view
 and cause it to consume memory (#10710 needs to be fixed for this to
 work):
  {{{
 def queryset(self, request):
 qs = super(...).queryset(request)
 return qs.only('list_display_field_1',
 
'list_display_field_2').select_related().only('related__field_used_in_string_representation')
  }}}

-- 
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-updates@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] #10712: ModelAdmin.queryset() is undocumented.

2009-04-03 Thread Django
#10712: ModelAdmin.queryset() is undocumented.
+---
  Reporter:  mrts   | Owner:  nobody
Status:  new| Milestone:  1.1   
 Component:  Documentation  |   Version:  1.0   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  1  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by mrts):

  * needs_better_patch:  => 0
  * needs_docs:  => 1
  * needs_tests:  => 0
  * milestone:  => 1.1

Comment:

 Tentatively pushing to 1.1, feel free to push to 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-updates@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] #10720: OrderedManyToMany API Implementation

2009-04-03 Thread Django
#10720: OrderedManyToMany API Implementation
---+
 Reporter:  Aryeh Leib Taurog   |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Database layer (models, ORM)   | Version:  SVN   
 Keywords:  Ordered ManyToMany |   Stage:  Unreviewed
Has_patch:  1  |  
---+
 In response to my post on django-users, Russ Magee suggested I open a
 ticket.
 http://groups.google.com/group/django-
 users/browse_frm/thread/2593060c8f3958ed#

 This patch uses the standard python list interface to provide a very
 simple
 API for keeping a singly-ordered many-to-many relation field.

 More info, plus a simple example and unit-tests here:
  http://www.aryehleib.com/MutableLists.html

-- 
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-updates@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] #10719: zero and PositiveIntegerField/PositiveSmallIntegerField

2009-04-03 Thread Django
#10719: zero and PositiveIntegerField/PositiveSmallIntegerField
---+
 Reporter:  while0pass |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Documentation  | Version:  1.0   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 [http://docs.djangoproject.com/en/dev/ref/models/fields/#positiveintegerfield]

 It would be good to state explicitly in documentation that
 PositiveIntegerField and PositiveSmallIntegerField are integers that are
 more or equal to zero. The confusion is that zero is not a positive
 integer. So, it would be good to either extend the relevant documentation
 subsections with a note on zero, or rename the field subclasses.
 Unfortunately, "NonNegativeIntegerField" looks rather unwieldy.

-- 
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-updates@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] #10718: Something's wrong with your database installation, make sure the database is readable by the appropriate user.

2009-04-03 Thread Django
#10718: Something's wrong with your database installation, make sure the 
database
is readable by the appropriate user.
-+--
  Reporter:  praveen_django  | Owner:  nobody   

  
Status:  closed  | Milestone:  1.0.3

  
 Component:  Authentication  |   Version:  1.0  

  
Resolution:  invalid |  Keywords:  Something's wrong with 
your database installation. Make sure the appropriate database tables have been 
created, and make sure the database is readable by the appropriate user.
 Stage:  Unreviewed  | Has_patch:  0

  
Needs_docs:  0   |   Needs_tests:  0

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

  * status:  new => closed
  * needs_better_patch:  => 0
  * resolution:  => invalid
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 The error message likely means exactly what it says: there's something
 wrong with your database installation.  Either you haven't created the
 tables needed to run request.user.get_profile() or the user specified in
 settings.py doesn't have permission to read it/them.  You don't indicate
 you have done anything to fix or verify that that is not in fact the
 problem, so I doubt there is any bug in Django here.  If you need help
 figuring out how to fix the problem with your database, post to django-
 users.  The ticket tracker is for reporting issues with Django itself, not
 usage help.

-- 
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-updates@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] #4377: Spelling errors in database error description

2009-04-03 Thread Django
#4377: Spelling errors in database error description
---+
  Reporter:  Frank tegtmeyer   | Owner:  
mtredinnick
Status:  closed| Milestone:  1.0.3  
 Component:  Translations  |   Version:  SVN
Resolution:  fixed |  Keywords: 
 Stage:  Ready for checkin | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  1 |  
---+
Comment (by praveen_django):

 Sorry this was my first time so did not know how to post ticket and this
 ticket was resemblance to my problem

-- 
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-updates@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] #4377: Spelling errors in database error description

2009-04-03 Thread Django
#4377: Spelling errors in database error description
---+
  Reporter:  Frank tegtmeyer   | Owner:  
mtredinnick
Status:  closed| Milestone:  1.0.3  
 Component:  Translations  |   Version:  SVN
Resolution:  fixed |  Keywords: 
 Stage:  Ready for checkin | Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  1 |  
---+
Changes (by ramiro):

  * status:  reopened => closed
  * component:  Authentication => Translations
  * needs_tests:  1 => 0
  * summary:  Something's wrong with your database installation, make sure
  the database is readable by the appropriate
  user. => Spelling errors in database error
  description
  * version:  1.0 => SVN
  * needs_docs:  1 => 0
  * has_patch:  1 => 0
  * resolution:  => fixed

Comment:

 You've done two things wrong:

  * Reopening a ticket that has been closed because it was fixed but
 without having seen the same error condition reported originally.
  * Re-purposing a ticket to something totally different (translations ->
 authentication) just because they happen to have the same literal in the
 summary field. Doing this you broke the history of this ticket for people
 looking for the issue associated with it and its corresponding fix.

 The effort this took you is the same effort it would take to send an
 e-mail to django-users (preferred) or to open another ticket.

-- 
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-updates@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] #10715: Link is dead on http://www.djangoproject.com/documentation/0.95/models/validation/#model-source-code

2009-04-03 Thread Django
#10715: Link is dead on
http://www.djangoproject.com/documentation/0.95/models/validation/#model-
source-code
+---
  Reporter:  kowito | Owner:  nobody
Status:  closed | Milestone:
 Component:  Uncategorized  |   Version:  1.0   
Resolution:  duplicate  |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by kmtracey):

  * status:  new => closed
  * needs_better_patch:  => 0
  * resolution:  => duplicate
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 This is a variant of #4043, only in this case you've got a link in old
 docs to something that doesn't exist in current docs instead of the other
 way around.  That example doesn't exist in the current version, likely
 because model validation doesn't exist in the current version.  The docs
 have gotten better about including invalid links like this (see the last
 note on #4043) but apparently it's not yet perfect.  Fixing up stuff in
 the old levels isn't going to be a priority, rather fixing the current
 docs to improve things moving forward is where effort will be spent.

-- 
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-updates@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] #10718: Something's wrong with your database installation, make sure the database is readable by the appropriate user.

2009-04-03 Thread Django
#10718: Something's wrong with your database installation, make sure the 
database
is readable by the appropriate user.
-+
 Reporter:  praveen_django  

 |   Owner:  nobody
   Status:  new 

 |   Milestone:  1.0.3 
Component:  Authentication  

 | Version:  1.0   
 Keywords:  Something's wrong with your database installation. Make sure the 
appropriate database tables have been created, and make sure the database is 
readable by the appropriate user.  |   Stage:  Unreviewed
Has_patch:  0   

 |  
-+
 {{{
 def queryset(self, request):
 qs = super(EventAdmin, self).queryset(request)
 if not request.user.is_superuser:
 qs =
 qs.filter(city=request.user.get_profile().res_city)
 return qs

 }}}

 it works fine as but it list out all the city's events


 {{{
 def queryset(self, request):
 qs = super(EventAdmin, self).queryset(request)
 if request.user.is_superuser:
 qs =
 qs.filter(city=request.user.get_profile().res_city)
 return qs


 }}}
 but when i change the if condition it gives error message

 Database error

 Something's wrong with your database installation. Make sure the
 appropriate database tables have been created, and make sure the database
 is readable by the appropriate user.

-- 
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-updates@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] #10197: Annotate breaks pickling of QuerySet

2009-04-03 Thread Django
#10197: Annotate breaks pickling of QuerySet
---+
  Reporter:  ja...@thelances.net   | Owner:  nobody 
   
Status:  new   | Milestone:  1.1
   
 Component:  Database layer (models, ORM)  |   Version:  SVN
   
Resolution:|  Keywords:  pickle, 
queryset, annotate
 Stage:  Accepted  | Has_patch:  0  
   
Needs_docs:  0 |   Needs_tests:  0  
   
Needs_better_patch:  0 |  
---+
Comment (by russellm):

 Interesting bit of history - #7506, fixed in [7773] logged a similar
 problem. Might give some pointers as to the possible cause.

-- 
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-updates@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] #4377: Something's wrong with your database installation, make sure the database is readable by the appropriate user.

2009-04-03 Thread Django
#4377: Something's wrong with your database installation, make sure the database
is readable by the appropriate user.
---+
  Reporter:  Frank tegtmeyer   | Owner:  
mtredinnick
Status:  reopened  | Milestone:  1.0.3  
 Component:  Authentication|   Version:  1.0
Resolution:|  Keywords: 
 Stage:  Ready for checkin | Has_patch:  1  
Needs_docs:  1 |   Needs_tests:  1  
Needs_better_patch:  1 |  
---+
Changes (by praveen_django):

  * status:  closed => reopened
 * cc: praveen.python.pl...@gmail.com (added)
  * needs_better_patch:  0 => 1
  * component:  Translations => Authentication
  * needs_tests:  0 => 1
  * summary:  Spelling errors in database error description => Something's
  wrong with your database installation, make
  sure the database is readable by the
  appropriate user.
  * version:  SVN => 1.0
  * milestone:  => 1.0.3
  * keywords:  translation german =>
  * needs_docs:  0 => 1
  * resolution:  fixed =>

Comment:

 {{{
 def queryset(self, request):
 qs = super(EventAdmin, self).queryset(request)
 if not request.user.is_superuser:
 qs =
 qs.filter(city=request.user.get_profile().res_city)
 return qs

 }}}

 it works fine as but it list out all the city's events


 {{{
 def queryset(self, request):
 qs = super(EventAdmin, self).queryset(request)
 if request.user.is_superuser:
 qs =
 qs.filter(city=request.user.get_profile().res_city)
 return qs

 }}}

 but when i '''change the if condition''' it gives error message

 Database error

 Something's wrong with your database installation. Make sure the
 appropriate database tables have been created, and make sure the database
 is readable by the appropriate user.

-- 
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-updates@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] #10717: {% admin_media_prefix %} needs escaping

2009-04-03 Thread Django
#10717: {% admin_media_prefix %} needs escaping
---+
  Reporter:  liangent  | Owner:  nobody
Status:  new   | Milestone:
 Component:  django.contrib.admin  |   Version:  1.0   
Resolution:|  Keywords:  liang...@gmail.com
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by liangent):

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

Comment:

 i think {% url %} also needs this, but i didn't check code to make sure if
 {% url %} already has it.

-- 
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-updates@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] #10717: {% admin_media_prefix %} needs escaping

2009-04-03 Thread Django
#10717: {% admin_media_prefix %} needs escaping
--+-
 Reporter:  liangent  |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  django.contrib.admin  | Version:  1.0   
 Keywords:  liang...@gmail.com|   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 in case that there are special symbols such as quotes in it.

-- 
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-updates@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] #10707: Sphinx & LaTeX: too many nesting section levels for LaTeX

2009-04-03 Thread Django
#10707: Sphinx & LaTeX: too many nesting section levels for LaTeX
+---
  Reporter:  kgrandis   | Owner:  nobody 
Status:  new| Milestone: 
 Component:  Documentation  |   Version:  1.0
Resolution: |  Keywords:  sphinx docs
 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-updates@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] #7506: Unable to pickle certain QuerySet objects due to use of curry function in RelatedField

2009-04-03 Thread Django
#7506: Unable to pickle certain QuerySet objects due to use of curry function in
RelatedField
---+
  Reporter:  mmalone   | Owner:  jacob  
  
Status:  closed| Milestone:  1.1
  
 Component:  Database layer (models, ORM)  |   Version:  1.1-beta-1 
  
Resolution:  fixed |  Keywords:  QuerySet 
pickle curry
 Stage:  Accepted  | Has_patch:  0  
  
Needs_docs:  0 |   Needs_tests:  0  
  
Needs_better_patch:  0 |  
---+
Comment (by wfa...@digipen.edu):

 russellm: 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-updates@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] #10716: Syntax error and bug in db/backends/oracle/creation.py

2009-04-03 Thread Django
#10716: Syntax error and bug in db/backends/oracle/creation.py
--+-
 Reporter:  canarix   |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  Database layer (models, ORM)  | Version:  1.0   
 Keywords:  oracle|   Stage:  Unreviewed
Has_patch:  1 |  
--+-
 Playing with the django tests on an Oracle DB, I've found 2 bugs in the
 db/backends/oracle/creation.py file :

 - line 110, the line settings.DATABASE_NAME = TEST_DATABASE_NAME is
 missing. Without this line, Django could use the production DB instead of
 the test one (can be quite annoying).
 This mod also impacts the mods on some other lines because of the
 "remember" dict.

 - line 247, there's 2 typos : it should be "def _test_database_user(self,
 settings):" instead of "def _test_database_user(self, ettings):" and
 DATABASE_USER instead of DATABASE_NAME

 I saw the problem in the 1.0.2 version, but the SVN has the same errors.

 Julien

 I attached a patch for the 1.0.2 version

-- 
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-updates@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] #7506: Unable to pickle certain QuerySet objects due to use of curry function in RelatedField

2009-04-03 Thread Django
#7506: Unable to pickle certain QuerySet objects due to use of curry function in
RelatedField
---+
  Reporter:  mmalone   | Owner:  jacob  
  
Status:  closed| Milestone:  1.1
  
 Component:  Database layer (models, ORM)  |   Version:  1.1-beta-1 
  
Resolution:  fixed |  Keywords:  QuerySet 
pickle curry
 Stage:  Accepted  | Has_patch:  0  
  
Needs_docs:  0 |   Needs_tests:  0  
  
Needs_better_patch:  0 |  
---+
Changes (by russellm):

  * status:  reopened => closed
  * resolution:  => fixed

Comment:

 @wfagan Your problem is slightly different, and is already logged as
 #10197.

-- 
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-updates@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] #5622: empty ipaddress raises an error (invalid input syntax for type inet: "")

2009-04-03 Thread Django
#5622: empty ipaddress raises an error (invalid input syntax for type inet: "")
---+
  Reporter:  anonymous | Owner:  anonymous  

Status:  new   | Milestone: 

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

Resolution:|  Keywords:  
sprintdec01, postgresql
 Stage:  Design decision needed| Has_patch:  1  

Needs_docs:  0 |   Needs_tests:  0  

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

  * needs_tests:  1 => 0

Comment:

 I've just attached the fix and the tests.

 Please, let me know if you find something is wrong to fix it. I'd love to
 get this into trunk before 1.1.

 Many 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-updates@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] #5622: empty ipaddress raises an error (invalid input syntax for type inet: "")

2009-04-03 Thread Django
#5622: empty ipaddress raises an error (invalid input syntax for type inet: "")
---+
  Reporter:  anonymous | Owner:  anonymous  

Status:  new   | Milestone: 

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

Resolution:|  Keywords:  
sprintdec01, postgresql
 Stage:  Design decision needed| Has_patch:  1  

Needs_docs:  0 |   Needs_tests:  1  

Needs_better_patch:  0 |  
---+
Comment (by msurdi):

 I'm using PostgresQL 8.3

 And I'm working on the fix and the tests.

-- 
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-updates@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] #10715: Link is dead on http://www.djangoproject.com/documentation/0.95/models/validation/#model-source-code

2009-04-03 Thread Django
#10715: Link is dead on
http://www.djangoproject.com/documentation/0.95/models/validation/#model-
source-code
---+
 Reporter:  kowito |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Uncategorized  | Version:  1.0   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 Link is dead on
 http://www.djangoproject.com/documentation/0.95/models/validation/#model-
 source-code

  This example describes Django version 0.95. For the current example, go
 here.

-- 
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-updates@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] #10714: Inconsistencies in deployment docs

2009-04-03 Thread Django
#10714: Inconsistencies in deployment docs
---+
 Reporter:  UloPe  |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Documentation  | Version:  SVN   
 Keywords: |   Stage:  Unreviewed
Has_patch:  1  |  
---+
 There are some inconsistencies in the deployment howtos since r10303 and
 r10280:
  * Both, the mod_python and the mod_wsgi page, claim to be the preferred
 way of Doing Things
  * The index page links to modwsgi twice.

-- 
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-updates@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] #7506: Unable to pickle certain QuerySet objects due to use of curry function in RelatedField

2009-04-03 Thread Django
#7506: Unable to pickle certain QuerySet objects due to use of curry function in
RelatedField
---+
  Reporter:  mmalone   | Owner:  jacob  
  
Status:  reopened  | Milestone:  1.1
  
 Component:  Database layer (models, ORM)  |   Version:  1.1-beta-1 
  
Resolution:|  Keywords:  QuerySet 
pickle curry
 Stage:  Accepted  | Has_patch:  0  
  
Needs_docs:  0 |   Needs_tests:  0  
  
Needs_better_patch:  0 |  
---+
Changes (by anonymous):

  * status:  closed => reopened
  * resolution:  fixed =>

-- 
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-updates@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] #7506: Unable to pickle certain QuerySet objects due to use of curry function in RelatedField

2009-04-03 Thread Django
#7506: Unable to pickle certain QuerySet objects due to use of curry function in
RelatedField
---+
  Reporter:  mmalone   | Owner:  jacob  
  
Status:  closed| Milestone:  1.1
  
 Component:  Database layer (models, ORM)  |   Version:  1.1-beta-1 
  
Resolution:  fixed |  Keywords:  QuerySet 
pickle curry
 Stage:  Accepted  | Has_patch:  0  
  
Needs_docs:  0 |   Needs_tests:  0  
  
Needs_better_patch:  0 |  
---+
Changes (by wfa...@digipen.edu):

  * has_patch:  1 => 0
  * version:  SVN => 1.1-beta-1
  * milestone:  1.0 => 1.1

Comment:

 I am running Django 1.1 beta and having this same problem I think.

 Can't pickle : it's not found as
 django.utils.functional._curried

 Here is my query.

 query =
 
Model.objects.all().annotate(liked_count=Count('liked_users')).exclude(liked_count=0).order_by('-liked_count')

 liked_users is a related name from my UserProfile objects.

 im doing ...

 pickle.dumps(query)

-- 
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-updates@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
-~--~~~~--~~--~--~---