Re: [Django] #10267: HttpResponse.build_absolute_uri does not encode IRIs properly.

2009-02-16 Thread Django
#10267: HttpResponse.build_absolute_uri does not encode IRIs properly.
+---
  Reporter:  liangent   | Owner:  nobody
Status:  reopened   | Milestone:
 Component:  HTTP handling  |   Version:  1.0   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by mtredinnick):

  * summary:  HttpResponsePermanentRedirect cannot accept chinese
  characters => HttpResponse.build_absolute_uri
  does not encode IRIs properly.

Comment:

 I'd guess that we should be calling `django.utils.encoding.iri_to_uri` in
 `build_absolute_uri()`. It's the URI constructor's job to encode things
 correctly and, in this case, that would probably be `build_absolute_uri`,
 since we use `request.path`, which is a unicode object.

 As noted by liangent, the problem is not specific to
 `HttpResponsePermanentRedirect`. I'll change the title of the 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] #10267: HttpResponsePermanentRedirect cannot accept chinese characters

2009-02-16 Thread Django
#10267: HttpResponsePermanentRedirect cannot accept chinese characters
+---
  Reporter:  liangent   | Owner:  nobody
Status:  reopened   | Milestone:
 Component:  HTTP handling  |   Version:  1.0   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Comment (by liangent):

 i think the problem is not in {{{HttpResponsePermanentRedirect}}} itself.

 the title may be a little bit unsuitable, but i didn't find somewhere to
 change the title.

-- 
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] #10267: HttpResponsePermanentRedirect cannot accept chinese characters

2009-02-16 Thread Django
#10267: HttpResponsePermanentRedirect cannot accept chinese characters
+---
  Reporter:  liangent   | Owner:  nobody
Status:  reopened   | Milestone:
 Component:  HTTP handling  |   Version:  1.0   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by liangent):

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

Comment:

 Django version 1.0.2 final

 detail here (just a simplified example to recreate the problem):

 create a project:
 {{{ django-admin.py startproject dj30x }}}

 go to {{{ dj30x }}} directory, edit {{{ urls.py }}}

 {{{
 from django.conf.urls.defaults import *

 urlpatterns = patterns('dj30x.views',
 # there will be no problem if i don't use chinese characters here
 (u'^中文/$', 'redir'),
 (u'^中文/done/$', 'done'),
 )
 }}}

 then create {{{ views.py }}} in the same directory

 {{{
 from django.http import *

 def redir(request):
 # the problem still exists if i change HttpResponseRedirect to
 # HttpResponsePermanentRedirect and/or change u'done/' to 'done/'
 return HttpResponseRedirect(u'done/')

 def done(request):
 return HttpResponse(u'done')
 }}}

 save all files, and {{{ manage.py runserver }}}, open {{{
 http://127.0.0.1:8000/%E4%B8%AD%E6%96%87/ }}} (i typed in {{{
 http://127.0.0.1:8000/中文/ }}}, and firefox encoded it automatically.), it
 says

 {{{
 Traceback (most recent call last):

   File "C:\Python25\Lib\site-packages\django\core\servers\basehttp.py",
 line 278, in run
 self.result = application(self.environ, self.start_response)

   File "C:\Python25\Lib\site-packages\django\core\servers\basehttp.py",
 line 635, in __call__
 return self.application(environ, start_response)

   File "C:\Python25\Lib\site-packages\django\core\handlers\wsgi.py", line
 244, in __call__
 response = self.apply_response_fixes(request, response)

   File "C:\Python25\Lib\site-packages\django\core\handlers\base.py", line
 174, in apply_response_fixes
 response = func(request, response)

   File "C:\Python25\Lib\site-packages\django\http\utils.py", line 20, in
 fix_location_header
 response['Location'] =
 request.build_absolute_uri(response['Location'])

   File "C:\Python25\Lib\site-packages\django\http\__init__.py", line 314,
 in __setitem__
 header, value = self._convert_to_ascii(header, value)

   File "C:\Python25\Lib\site-packages\django\http\__init__.py", line 306,
 in _convert_to_ascii
 yield value.encode('us-ascii')

 UnicodeEncodeError: 'ascii' codec can't encode characters in position
 22-23: ordinal not in range(128), HTTP response headers must be in US-
 ASCII format
 }}}

 note: {{{ http://127.0.0.1:8000/%E4%B8%AD%E6%96%87/done/ }}} can be viewed
 correctly.

-- 
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] #2507: [patch] LDAPBackend in django/contrib/auth/backends.py

2009-02-16 Thread Django
#2507: [patch] LDAPBackend in django/contrib/auth/backends.py
---+
  Reporter:  s...@mahonri5.net  | Owner:  nobody
Status:  new   | Milestone:
 Component:  Contrib apps  |   Version:  SVN   
Resolution:|  Keywords:  ldap,usernames
 Stage:  Accepted  | Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  1 
Needs_better_patch:  1 |  
---+
Changes (by Guilherme Gondim ):

 * cc: seme...@taurinus.org (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-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] #2288: Provide an equivalent for 'ON DELETE' and friends

2009-02-16 Thread Django
#2288: Provide an equivalent for 'ON DELETE' and friends
-+--
  Reporter:  ubernostrum | Owner:  nobody
Status:  closed  | Milestone:
 Component:  Core framework  |   Version:
Resolution:  wontfix |  Keywords:
 Stage:  Design decision needed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by gonz):

 * cc: gonz (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-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] #5833: [newforms-admin] Custom FilterSpecs

2009-02-16 Thread Django
#5833: [newforms-admin] Custom FilterSpecs
---+
  Reporter:  Honza_Kral| Owner:  jkocherhans
 
Status:  assigned  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  nfa-someday 
list_filter filterspec nfa-changelist ep2008
 Stage:  Accepted  | Has_patch:  1  
 
Needs_docs:  0 |   Needs_tests:  1  
 
Needs_better_patch:  0 |  
---+
Changes (by gonz):

 * cc: gonz (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-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] #8962: Make `input_formats` and `format` work consistently across `date`, `datetime`, and `time` fields and widgets.

2009-02-16 Thread Django
#8962: Make `input_formats` and `format` work consistently across `date`,
`datetime`, and `time` fields and widgets.
-+--
  Reporter:  mrmachine   | Owner:  nobody   
 
Status:  new | Milestone:  post-1.0 
 
 Component:  Forms   |   Version:  SVN  
 
Resolution:  |  Keywords:  datetime format widget 
i18n-rf
 Stage:  Unreviewed  | Has_patch:  1
 
Needs_docs:  0   |   Needs_tests:  0
 
Needs_better_patch:  0   |  
-+--
Comment (by mrmachine):

 Looks like `SplitDateTimeField` does use `SplitDateTimeWidget` by default
 in r9843, so I've updated the patch to work on trunk again.

-- 
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] #10281: generic inline formsets don't allow custom prefix

2009-02-16 Thread Django
#10281: generic inline formsets don't allow custom prefix
---+
  Reporter:  akaihola  | Owner:  brosner
Status:  new   | Milestone: 
 Component:  Contrib apps  |   Version:  SVN
Resolution:|  Keywords: 
 Stage:  Unreviewed| Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by Alex):

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

Comment:

 FWIW this was added in the patch on #10271 as well, as it was necessary to
 write the actual patch :)

-- 
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] #10281: generic inline formsets don't allow custom prefix

2009-02-16 Thread Django
#10281: generic inline formsets don't allow custom prefix
--+-
 Reporter:  akaihola  |   Owner:  brosner   
   Status:  new   |   Milestone:
Component:  Contrib apps  | Version:  SVN   
 Keywords:|   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 Generic inline formset classes created with
 {{{generic_inlineformset_factory()}}} don't accept the {{{prefix=}}}
 keyword argument. They constructs the prefix from the app, model and
 generic relation field names instead.

 The inability to override the prefix is not consistent with other form and
 formset classes, which all do accept the {{{prefix=}}} kwarg.

-- 
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] #8898: `required` validation bypassed when using `DateTimeField` with `SplitDateTimeWidget`.

2009-02-16 Thread Django
#8898: `required` validation bypassed when using `DateTimeField` with
`SplitDateTimeWidget`.
-+--
  Reporter:  mrmachine   | Owner:  nobody   

Status:  new | Milestone:   

 Component:  Forms   |   Version:  SVN  

Resolution:  |  Keywords:  DateTimeField 
SplitDateTimeWidget
 Stage:  Design decision needed  | Has_patch:  1

Needs_docs:  0   |   Needs_tests:  0

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

  * stage:  Accepted => Design decision needed

Comment:

 Replying to [comment:8 mrmachine]:
 > It's currently impossible to use an optional DateTimeField in the Django
 admin, with an exception being generated if no value is specified.

 That doesn't seem to be true; this works fine for me:

 {{{
 class Bug8898(models.Model):
 timestamp = models.DateTimeField(blank=True, null=True)
 }}}

 I'm thinking there's not a bug here -- as Karen said, `SplitDateTimeField`
 is the right choice here -- but if there is can you please clarify how (if
 at all) this breaks forms and/or the admin?

-- 
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] #4979: Admin does not allow removal of an image from an ImageField after it has been set, even if null=True and blank=True

2009-02-16 Thread Django
#4979: Admin does not allow removal of an image from an ImageField after it has
been set, even if null=True and blank=True
---+
  Reporter:  robvdl| Owner:  nobody
Status:  reopened  | Milestone:
 Component:  django.contrib.admin  |   Version:  SVN   
Resolution:|  Keywords:  ImageField
 Stage:  Accepted  | Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  1 |  
---+
Changes (by jacob):

  * needs_better_patch:  0 => 1

Comment:

 This aproach is fine with me, but overloading `False` to mean "delete the
 file" smells bad to me. A relatively easy change that'd remove (some of)
 the smell would be to use a sentinel object (i.e. `DeleteFile = object()`)
 instead of `False`.

-- 
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] r9843 - django/trunk/django/core/management

2009-02-16 Thread noreply

Author: jacob
Date: 2009-02-16 15:03:09 -0600 (Mon, 16 Feb 2009)
New Revision: 9843

Modified:
   django/trunk/django/core/management/__init__.py
Log:
Merge branch 'master' into upstream-trunk

Modified: django/trunk/django/core/management/__init__.py
===
--- django/trunk/django/core/management/__init__.py 2009-02-16 20:47:39 UTC 
(rev 9842)
+++ django/trunk/django/core/management/__init__.py 2009-02-16 21:03:09 UTC 
(rev 9843)
@@ -319,15 +319,18 @@
 if settings_name.endswith("$py"):
 settings_name = settings_name[:-3]
 
-sys.path.append(os.path.join(project_directory, os.pardir))
-project_module = __import__(project_name, {}, {}, [''])
-sys.path.pop()
-
 # Set DJANGO_SETTINGS_MODULE appropriately.
 if original_settings_path:
 os.environ['DJANGO_SETTINGS_MODULE'] = original_settings_path
 else:
 os.environ['DJANGO_SETTINGS_MODULE'] = '%s.%s' % (project_name, 
settings_name)
+
+# Import the project module. We add the parent directory to PYTHONPATH to 
+# avoid some of the path errors new users can have.
+sys.path.append(os.path.join(project_directory, os.pardir))
+project_module = __import__(project_name, {}, {}, [''])
+sys.path.pop()
+
 return project_directory
 
 def execute_from_command_line(argv=None):


--~--~-~--~~~---~--~~
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] #9029: `get_or_create` broken due to inconsistent behaviour between `create` and `filter` on Manager, RelatedManager, QuerySet, etc.

2009-02-16 Thread Django
#9029: `get_or_create` broken due to inconsistent behaviour between `create` and
`filter` on Manager, RelatedManager, QuerySet, etc.
---+
  Reporter:  mrmachine | Owner:  nobody 
   
Status:  new   | Milestone: 
   
 Component:  Database layer (models, ORM)  |   Version:  SVN
   
Resolution:|  Keywords:  
get_or_create get create filter FieldError
 Stage:  Accepted  | Has_patch:  0  
   
Needs_docs:  0 |   Needs_tests:  0  
   
Needs_better_patch:  0 |  
---+
Changes (by jacob):

  * stage:  Unreviewed => Accepted

Comment:

 Julian's right that `Model.objects.get_or_create(related__id=N,
 defaults={'related': related_instance})` works and is an acceptable-if-
 ugly workaround.

 However, there's no reason not to make the test given in the patch work,
 so I'm marking this accepted. If someone wants to work on it, the place to
 look is in the `QuerySet` implementation.

-- 
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] r9842 - in django/trunk: django/core tests/regressiontests/mail

2009-02-16 Thread noreply

Author: jacob
Date: 2009-02-16 14:47:39 -0600 (Mon, 16 Feb 2009)
New Revision: 9842

Modified:
   django/trunk/django/core/mail.py
   django/trunk/tests/regressiontests/mail/tests.py
Log:
Fixed #9214: EmailMessage now respects the From header instead of blindly using 
from_email. Thanks, Tai Lee.

Modified: django/trunk/django/core/mail.py
===
--- django/trunk/django/core/mail.py2009-02-16 18:34:28 UTC (rev 9841)
+++ django/trunk/django/core/mail.py2009-02-16 20:47:39 UTC (rev 9842)
@@ -245,7 +245,7 @@
 else:
 msg.attach(self._create_attachment(*attachment))
 msg['Subject'] = self.subject
-msg['From'] = self.from_email
+msg['From'] = self.extra_headers.pop('From', self.from_email)
 msg['To'] = ', '.join(self.to)
 
 # Email header names are case-insensitive (RFC 2045), so we have to

Modified: django/trunk/tests/regressiontests/mail/tests.py
===
--- django/trunk/tests/regressiontests/mail/tests.py2009-02-16 18:34:28 UTC 
(rev 9841)
+++ django/trunk/tests/regressiontests/mail/tests.py2009-02-16 20:47:39 UTC 
(rev 9842)
@@ -88,4 +88,11 @@
 >>> settings.ADMINS = old_admins
 >>> settings.MANAGERS = old_managers
 
+# Make sure we can manually set the From header (#9214)
+
+>>> email = EmailMessage('Subject', 'Content', 'bou...@example.com', 
['t...@example.com'], headers={'From': 'f...@example.com'}) 
+>>> message = email.message() 
+>>> message['From']
+'f...@example.com'
+
 """


--~--~-~--~~~---~--~~
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] #9656: Inherit user's password change link doesn't work

2009-02-16 Thread Django
#9656: Inherit user's password change link doesn't work
---+
  Reporter:  syabro| Owner:  nobody
Status:  new   | Milestone:
 Component:  django.contrib.admin  |   Version:  1.0   
Resolution:|  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Comment (by a...@atwiss.com):

 I've seen exactly the same problem (Django 1.02)

-- 
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] #8960: "View on site" does not work if contrib.sites is not installed

2009-02-16 Thread Django
#8960: "View on site" does not work if contrib.sites is not installed
-+--
  Reporter:  bmihelac| Owner:  adrian  
Status:  assigned| Milestone:  post-1.0
 Component:  Core framework  |   Version:  1.0 
Resolution:  |  Keywords:  
 Stage:  Accepted| Has_patch:  1   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Comment (by matthijs):

 Any chance of adding this trivial patch?

-- 
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] #5833: [newforms-admin] Custom FilterSpecs

2009-02-16 Thread Django
#5833: [newforms-admin] Custom FilterSpecs
---+
  Reporter:  Honza_Kral| Owner:  jkocherhans
 
Status:  assigned  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  nfa-someday 
list_filter filterspec nfa-changelist ep2008
 Stage:  Accepted  | Has_patch:  1  
 
Needs_docs:  0 |   Needs_tests:  1  
 
Needs_better_patch:  0 |  
---+
Comment (by kmtracey):

 I deleted the 5833-against-9836-new.patch to avoid confusion.

-- 
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] r9841 - in django/trunk: . django/db/models/fields tests/modeltests/model_forms

2009-02-16 Thread noreply

Author: kmtracey
Date: 2009-02-16 12:34:28 -0600 (Mon, 16 Feb 2009)
New Revision: 9841

Added:
   django/trunk/tests/modeltests/model_forms/test2.png
Modified:
   django/trunk/AUTHORS
   django/trunk/django/db/models/fields/files.py
   django/trunk/tests/modeltests/model_forms/models.py
Log:
Fixed #10196: Restored setting of image file width and height fields lost in 
r9766, and added tests for this function.  Thanks to vicvicvic for the ticket 
and patch and for Alex for reminding me not to break non-PIL-boxes with the new 
tests.


Modified: django/trunk/AUTHORS
===
--- django/trunk/AUTHORS2009-02-16 17:30:12 UTC (rev 9840)
+++ django/trunk/AUTHORS2009-02-16 18:34:28 UTC (rev 9841)
@@ -35,6 +35,7 @@
 Jeff Anderson 
 Marian Andre 
 Andreas
+Victor Andrée
 a...@jadedplanet.net
 Fabrice Aneche 
 ant9...@netwise.it

Modified: django/trunk/django/db/models/fields/files.py
===
--- django/trunk/django/db/models/fields/files.py   2009-02-16 17:30:12 UTC 
(rev 9840)
+++ django/trunk/django/db/models/fields/files.py   2009-02-16 18:34:28 UTC 
(rev 9841)
@@ -132,7 +132,7 @@
 # have the FieldFile interface added to them
 file_copy = copy.copy(file)
 file_copy.__class__ = type(file.__class__.__name__, 
-   (file.__class__, FieldFile), {})
+   (file.__class__, 
self.field.attr_class), {})
 file_copy.instance = instance
 file_copy.field = self.field
 file_copy.storage = self.field.storage

Modified: django/trunk/tests/modeltests/model_forms/models.py
===
--- django/trunk/tests/modeltests/model_forms/models.py 2009-02-16 17:30:12 UTC 
(rev 9840)
+++ django/trunk/tests/modeltests/model_forms/models.py 2009-02-16 18:34:28 UTC 
(rev 9841)
@@ -98,26 +98,47 @@
 def __unicode__(self):
 return self.description
 
-class ImageFile(models.Model):
-def custom_upload_path(self, filename):
-path = self.path or 'tests'
-return '%s/%s' % (path, filename)
+try:
+# If PIL is available, try testing ImageFields.
+# Checking for the existence of Image is enough for CPython, but
+# for PyPy, you need to check for the underlying modules
+# If PIL is not available, ImageField tests are omitted.
+from PIL import Image, _imaging
+test_images = True
 
-description = models.CharField(max_length=20)
-try:
-# If PIL is available, try testing PIL.
-# Checking for the existence of Image is enough for CPython, but
-# for PyPy, you need to check for the underlying modules
-# If PIL is not available, this test is equivalent to TextFile above.
-from PIL import Image, _imaging
-image = models.ImageField(storage=temp_storage, 
upload_to=custom_upload_path)
-except ImportError:
-image = models.FileField(storage=temp_storage, 
upload_to=custom_upload_path)
-path = models.CharField(max_length=16, blank=True, default='')
+class ImageFile(models.Model):
+def custom_upload_path(self, filename):
+path = self.path or 'tests'
+return '%s/%s' % (path, filename)
+
+description = models.CharField(max_length=20)
+image = models.ImageField(storage=temp_storage, 
upload_to=custom_upload_path,
+  width_field='width', height_field='height')
+width = models.IntegerField(editable=False)
+height = models.IntegerField(editable=False)
+path = models.CharField(max_length=16, blank=True, default='')
 
-def __unicode__(self):
-return self.description
+def __unicode__(self):
+return self.description
+
+class OptionalImageFile(models.Model):
+def custom_upload_path(self, filename):
+path = self.path or 'tests'
+return '%s/%s' % (path, filename)
+
+description = models.CharField(max_length=20)
+image = models.ImageField(storage=temp_storage, 
upload_to=custom_upload_path,
+  width_field='width', height_field='height', 
+  blank=True, null=True)
+width = models.IntegerField(editable=False, null=True)
+height = models.IntegerField(editable=False, null=True)
+path = models.CharField(max_length=16, blank=True, default='')
 
+def __unicode__(self):
+return self.description
+except ImportError:
+test_images = False
+
 class CommaSeparatedInteger(models.Model):
 field = models.CommaSeparatedIntegerField(max_length=20)
 
@@ -1056,7 +1077,10 @@
 # Delete the current file since this is not done by Django.
 >>> instance.file.delete()
 >>> instance.delete()
+"""}

Re: [Django] #5833: [newforms-admin] Custom FilterSpecs

2009-02-16 Thread Django
#5833: [newforms-admin] Custom FilterSpecs
---+
  Reporter:  Honza_Kral| Owner:  jkocherhans
 
Status:  assigned  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  nfa-someday 
list_filter filterspec nfa-changelist ep2008
 Stage:  Accepted  | Has_patch:  1  
 
Needs_docs:  0 |   Needs_tests:  1  
 
Needs_better_patch:  0 |  
---+
Comment (by ean...@gmail.com):

 Please see 5833-against-9836-new-proper.patch and not
 5833-against-9836-new.patch; I accidently diffed some additional,
 unrelated changes, and couldn't get trac to replace the old attachment.

-- 
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] #5833: [newforms-admin] Custom FilterSpecs

2009-02-16 Thread Django
#5833: [newforms-admin] Custom FilterSpecs
---+
  Reporter:  Honza_Kral| Owner:  jkocherhans
 
Status:  assigned  | Milestone: 
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  nfa-someday 
list_filter filterspec nfa-changelist ep2008
 Stage:  Accepted  | Has_patch:  1  
 
Needs_docs:  0 |   Needs_tests:  1  
 
Needs_better_patch:  0 |  
---+
Changes (by ean...@gmail.com):

 * cc: ean...@gmail.com (added)
  * needs_better_patch:  1 => 0
  * needs_tests:  0 => 1
  * stage:  Design decision needed => Accepted

Comment:

 I am attaching a new patch against the latest HEAD. It's based on
 gerdemb's patch but now allows for consuming of GET parameters to allow
 for custom, non-field based querystring keys. The patch also implements a
 priority queue in a sense; FieldFilterSpec.register() allows you to pass
 in high_priority=True in order to register the FieldFilterSpec as high
 priority. This argument is True by default but passed in as False for all
 default filter specs. High priority specs are inserted before normal
 priority specs, but order is preserved amongst the two separate groups.
 Let me know what you think of that solution.

 I'm also moving this to Accepted since it's on the 1.1 features list
 (forgive me if this is an incorrect decision). Also flagging it as Needs
 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
-~--~~~~--~~--~--~---



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2009-02-16 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody  
Status:  new | Milestone:  post-1.0
 Component:  Serialization   |   Version:  SVN 
Resolution:  |  Keywords:  feature 
 Stage:  Accepted| Has_patch:  0   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Changes (by datavortex):

 * cc: datavor...@datavortex.net (added)

Comment:

 I am also using the extras functionality to serialize non-field properties
 of models, and I do think this feature is generally useful enough to be
 included in Django.  In my case, my application uses two datastores for
 its information, and the django models are supplemented with information
 from the second datastore.  Sometimes I want to serialize these properties
 and sometimes I don't.  The ability to use the extras argument solves 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] #4121: DateTime, Date, Time, MonthDay, YearMonth for general usage

2009-02-16 Thread Django
#4121: DateTime, Date,Time, MonthDay, YearMonth for general usage
-+--
  Reporter:  Ciantic | Owner:  nobody   
  
Status:  new | Milestone:  post-1.0 
  
 Component:  Internationalization|   Version:  SVN  
  
Resolution:  |  Keywords:  localization 
i18n local-datetime-format local-date-format local-time-format
 Stage:  Design decision needed  | Has_patch:  1
  
Needs_docs:  0   |   Needs_tests:  0
  
Needs_better_patch:  0   |  
-+--
Changes (by Ciantic):

  * milestone:  => post-1.0

Comment:

 Is this still relevant? Does Django 1.0 provide a way to use these hidden
 features in templates (where they are most needed)?

 Also the patch may need modifications, as this is old.

-- 
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] #10278: [spam]

2009-02-16 Thread Django
#10278: [spam]
+---
  Reporter:  anonymous  | Owner:  nobody
Status:  closed | Milestone:
 Component:  Uncategorized  |   Version:  1.0   
Resolution:  invalid|  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by Alex):

  * status:  new => closed
 * cc: tlqMydHyQP (removed)
  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * summary:  iuqRuqKFdnYgJf => [spam]
  * keywords:  YbCunQBs =>
  * needs_docs:  => 0
  * resolution:  => invalid

Old description:

> 4jhXSE  http://rqzzdbaclmbb.com/";>rqzzdbaclmbb,
> [url=http://ptohqrfhkveu.com/]ptohqrfhkveu[/url],
> [link=http://uwxkffefbwyc.com/]uwxkffefbwyc[/link],
> http://sevddqsrkywj.com/

New description:

 [spam]

-- 
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] #10279: [spam]

2009-02-16 Thread Django
#10279: [spam]
+---
  Reporter:  anonymous  | Owner:  nobody
Status:  closed | Milestone:
 Component:  Uncategorized  |   Version:  1.0   
Resolution:  invalid|  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by Alex):

  * status:  new => closed
 * cc: tlqMydHyQP (removed)
  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * summary:  iuqRuqKFdnYgJf => [spam]
  * keywords:  YbCunQBs =>
  * needs_docs:  => 0
  * resolution:  => invalid

Old description:

> 4jhXSE  http://rqzzdbaclmbb.com/";>rqzzdbaclmbb,
> [url=http://ptohqrfhkveu.com/]ptohqrfhkveu[/url],
> [link=http://uwxkffefbwyc.com/]uwxkffefbwyc[/link],
> http://sevddqsrkywj.com/

New description:

 [spam]

-- 
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] #10277: [SPAM]

2009-02-16 Thread Django
#10277: [SPAM]
+---
  Reporter:  anonymous  | Owner:  nobody
Status:  closed | Milestone:
 Component:  Uncategorized  |   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
 * cc: tlqMydHyQP (removed)
  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * summary:  iuqRuqKFdnYgJf => [SPAM]
  * keywords:  YbCunQBs =>
  * needs_docs:  => 0
  * resolution:  => invalid

Old description:

> 4jhXSE  http://rqzzdbaclmbb.com/";>rqzzdbaclmbb,
> [url=http://ptohqrfhkveu.com/]ptohqrfhkveu[/url],
> [link=http://uwxkffefbwyc.com/]uwxkffefbwyc[/link],
> http://sevddqsrkywj.com/

New description:



-- 
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] #10280: [spam]

2009-02-16 Thread Django
#10280: [spam]
+---
  Reporter:  anonymous  | Owner:  nobody
Status:  closed | Milestone:
 Component:  Uncategorized  |   Version:  1.0   
Resolution:  invalid|  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
  * needs_tests:  => 0
  * summary:  iuqRuqKFdnYgJf => [spam]
  * keywords:  YbCunQBs =>
  * needs_docs:  => 0
  * resolution:  => invalid

Old description:

> 4jhXSE  http://rqzzdbaclmbb.com/";>rqzzdbaclmbb,
> [url=http://ptohqrfhkveu.com/]ptohqrfhkveu[/url],
> [link=http://uwxkffefbwyc.com/]uwxkffefbwyc[/link],
> http://sevddqsrkywj.com/

New description:

 [spam]

-- 
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] #10276: [SPAM]

2009-02-16 Thread Django
#10276: [SPAM]
+---
  Reporter:  anonymous  | Owner:  nobody  
Status:  closed | Milestone:  
 Component:  Uncategorized  |   Version:  1.0 
Resolution:  invalid|  Keywords:  YbCunQBs
 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
  * needs_tests:  => 0
  * summary:  iuqRuqKFdnYgJf => [SPAM]
  * needs_docs:  => 0
  * resolution:  => invalid

Old description:

> 4jhXSE  http://rqzzdbaclmbb.com/";>rqzzdbaclmbb,
> [url=http://ptohqrfhkveu.com/]ptohqrfhkveu[/url],
> [link=http://uwxkffefbwyc.com/]uwxkffefbwyc[/link],
> http://sevddqsrkywj.com/

New description:



-- 
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] #10280: iuqRuqKFdnYgJf

2009-02-16 Thread Django
#10280: iuqRuqKFdnYgJf
---+
Reporter:  anonymous   |   Owner:  nobody   
  Status:  new |   Component:  Uncategorized
 Version:  1.0 |Keywords:  YbCunQBs 
   Stage:  Unreviewed  |   Has_patch:  0
---+
 4jhXSE  http://rqzzdbaclmbb.com/";>rqzzdbaclmbb,
 [url=http://ptohqrfhkveu.com/]ptohqrfhkveu[/url],
 [link=http://uwxkffefbwyc.com/]uwxkffefbwyc[/link],
 http://sevddqsrkywj.com/

-- 
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] #10279: iuqRuqKFdnYgJf

2009-02-16 Thread Django
#10279: iuqRuqKFdnYgJf
---+
Reporter:  anonymous   |   Owner:  nobody   
  Status:  new |   Component:  Uncategorized
 Version:  1.0 |Keywords:  YbCunQBs 
   Stage:  Unreviewed  |   Has_patch:  0
---+
 4jhXSE  http://rqzzdbaclmbb.com/";>rqzzdbaclmbb,
 [url=http://ptohqrfhkveu.com/]ptohqrfhkveu[/url],
 [link=http://uwxkffefbwyc.com/]uwxkffefbwyc[/link],
 http://sevddqsrkywj.com/

-- 
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] #10278: iuqRuqKFdnYgJf

2009-02-16 Thread Django
#10278: iuqRuqKFdnYgJf
---+
Reporter:  anonymous   |   Owner:  nobody   
  Status:  new |   Component:  Uncategorized
 Version:  1.0 |Keywords:  YbCunQBs 
   Stage:  Unreviewed  |   Has_patch:  0
---+
 4jhXSE  http://rqzzdbaclmbb.com/";>rqzzdbaclmbb,
 [url=http://ptohqrfhkveu.com/]ptohqrfhkveu[/url],
 [link=http://uwxkffefbwyc.com/]uwxkffefbwyc[/link],
 http://sevddqsrkywj.com/

-- 
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] #10277: iuqRuqKFdnYgJf

2009-02-16 Thread Django
#10277: iuqRuqKFdnYgJf
---+
Reporter:  anonymous   |   Owner:  nobody   
  Status:  new |   Component:  Uncategorized
 Version:  1.0 |Keywords:  YbCunQBs 
   Stage:  Unreviewed  |   Has_patch:  0
---+
 4jhXSE  http://rqzzdbaclmbb.com/";>rqzzdbaclmbb,
 [url=http://ptohqrfhkveu.com/]ptohqrfhkveu[/url],
 [link=http://uwxkffefbwyc.com/]uwxkffefbwyc[/link],
 http://sevddqsrkywj.com/

-- 
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] #10276: iuqRuqKFdnYgJf

2009-02-16 Thread Django
#10276: iuqRuqKFdnYgJf
---+
Reporter:  anonymous   |   Owner:  nobody   
  Status:  new |   Component:  Uncategorized
 Version:  1.0 |Keywords:  YbCunQBs 
   Stage:  Unreviewed  |   Has_patch:  0
---+
 4jhXSE  http://rqzzdbaclmbb.com/";>rqzzdbaclmbb,
 [url=http://ptohqrfhkveu.com/]ptohqrfhkveu[/url],
 [link=http://uwxkffefbwyc.com/]uwxkffefbwyc[/link],
 http://sevddqsrkywj.com/

-- 
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] r9840 - in django/trunk: django/db/models/fields tests/modeltests/model_forms

2009-02-16 Thread noreply

Author: kmtracey
Date: 2009-02-16 11:30:12 -0600 (Mon, 16 Feb 2009)
New Revision: 9840

Modified:
   django/trunk/django/db/models/fields/files.py
   django/trunk/tests/modeltests/model_forms/models.py
Log:
Fixed #10121: Restored code lost in r9766 that prevented overwriting an 
already-set blank=True FileField with blank.  This would happen, for instance, 
in the admin if an object with a FileField was edited/saved but the file not 
re-uploaded, resulting in the association to the previously-uploaded file being 
lost.  Adding the ability to re-blank FileFields when they are once set is the 
subject of a different ticket (#7048), for now the pre-9766 behavior here has 
just been restored in order to avoid unexpected data loss.  Thanks to Alex for 
help in understanding how to fix this without un-doing the intent of r9766.


Modified: django/trunk/django/db/models/fields/files.py
===
--- django/trunk/django/db/models/fields/files.py   2009-02-16 12:38:11 UTC 
(rev 9839)
+++ django/trunk/django/db/models/fields/files.py   2009-02-16 17:30:12 UTC 
(rev 9840)
@@ -213,6 +213,10 @@
 def generate_filename(self, instance, filename):
 return os.path.join(self.get_directory_name(), 
self.get_filename(filename))
 
+def save_form_data(self, instance, data):
+if data:
+setattr(instance, self.name, data)
+
 def formfield(self, **kwargs):
 defaults = {'form_class': forms.FileField}
 # If a file has been provided previously, then the form doesn't require

Modified: django/trunk/tests/modeltests/model_forms/models.py
===
--- django/trunk/tests/modeltests/model_forms/models.py 2009-02-16 12:38:11 UTC 
(rev 9839)
+++ django/trunk/tests/modeltests/model_forms/models.py 2009-02-16 17:30:12 UTC 
(rev 9840)
@@ -1030,6 +1030,18 @@
 >>> instance.file
 
 
+# Instance can be edited w/out re-uploading the file and existing file should 
be preserved.
+
+>>> f = TextFileForm(data={'description': u'New Description'}, 
instance=instance)
+>>> f.fields['file'].required = False
+>>> f.is_valid()
+True
+>>> instance = f.save()
+>>> instance.description
+u'New Description'
+>>> instance.file
+
+
 # Delete the current file since this is not done by Django.
 >>> instance.file.delete()
 >>> instance.delete()


--~--~-~--~~~---~--~~
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] #10271: Models with multiple inlines inheriting from the same parent class do not save properly in admin

2009-02-16 Thread Django
#10271: Models with multiple inlines inheriting from the same parent class do 
not
save properly in admin
---+
  Reporter:  idangazit | Owner:  nobody
Status:  new   | Milestone:
 Component:  django.contrib.admin  |   Version:  1.0   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by Alex):

  * stage:  Unreviewed => Accepted

Comment:

 Tests all look good and correct by me, needs someone to review and mark as
 RFC and/or a committer.

-- 
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] #10274: BaseGenericInlineFormSet.get_queryset calls .empty()

2009-02-16 Thread Django
#10274: BaseGenericInlineFormSet.get_queryset calls .empty()
+---
  Reporter:  Zak Johnson   | Owner:  brosner
Status:  assigned   | Milestone: 
 Component:  Contrib apps   |   Version:  SVN
Resolution: |  Keywords: 
 Stage:  Accepted   | Has_patch:  1  
Needs_docs:  0  |   Needs_tests:  0  
Needs_better_patch:  0  |  
+---
Comment (by Alex):

 I think what you really want is .none()

-- 
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] #9318: "Virtual" behaviour for signal dispatcher and model inheritance

2009-02-16 Thread Django
#9318: "Virtual" behaviour for signal dispatcher and model inheritance
-+--
  Reporter:  svetlyak40wt| Owner:  nobody   
   
Status:  new | Milestone:   
   
 Component:  Core framework  |   Version:  1.0  
   
Resolution:  |  Keywords:  model inheritance, 
signals, dispatch
 Stage:  Accepted| Has_patch:  1
   
Needs_docs:  0   |   Needs_tests:  0
   
Needs_better_patch:  0   |  
-+--
Changes (by idangazit):

 * cc: idangazit (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-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] #10121: ImageField (and FileField) loses data when re-saving from admin

2009-02-16 Thread Django
#10121: ImageField (and FileField) loses data when re-saving from admin
---+
  Reporter:  Uninen| Owner:  kmtracey   

Status:  assigned  | Milestone: 

 Component:  django.contrib.admin  |   Version:  SVN

Resolution:|  Keywords:  admin, ImageField, 
save
 Stage:  Accepted  | Has_patch:  0  

Needs_docs:  0 |   Needs_tests:  0  

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

  * owner:  => kmtracey
  * status:  new => assigned

Comment:

 Replying to [comment:13 Alex]:
 > I've attached a patch that reinstates the save_form_data but still using
 the assignment, that way we still defer saving of the file to it's final
 on-disk location until the model is saved.

 Ah, OK, I think I understand.  And the subtle difference between whether
 the file data is saved during `save_form_data` or later is a bit hard to
 test, I guess.  We're then left with a `save_form_data` whose entire
 reason for being, I think, is to prevent re-blanking of an already-set
 blank=True !FileField.  Perhaps future work to support re-blanking such
 fields will get rid of the need for this, but for now I guess it is OK to
 restore the old status quo.

-- 
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] #10274: BaseGenericInlineFormSet.get_queryset calls .empty()

2009-02-16 Thread Django
#10274: BaseGenericInlineFormSet.get_queryset calls .empty()
+---
  Reporter:  Zak Johnson   | Owner:  brosner
Status:  assigned   | Milestone: 
 Component:  Contrib apps   |   Version:  SVN
Resolution: |  Keywords: 
 Stage:  Accepted   | Has_patch:  1  
Needs_docs:  0  |   Needs_tests:  0  
Needs_better_patch:  0  |  
+---
Changes (by brosner):

  * status:  new => assigned
  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * owner:  nobody => brosner
  * needs_docs:  => 0
  * stage:  Unreviewed => Accepted

Comment:

 Wow, that must have been a brain dead commit by me. You are correct
 `empty()` is not on a manager, but `none()` would have been correct here.
 Thanks for the patch!

-- 
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] #10121: ImageField (and FileField) loses data when re-saving from admin

2009-02-16 Thread Django
#10121: ImageField (and FileField) loses data when re-saving from admin
---+
  Reporter:  Uninen| Owner: 

Status:  new   | Milestone: 

 Component:  django.contrib.admin  |   Version:  SVN

Resolution:|  Keywords:  admin, ImageField, 
save
 Stage:  Accepted  | Has_patch:  0  

Needs_docs:  0 |   Needs_tests:  0  

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

 Replying to [comment:12 kmtracey]:
 > I've attached a patch that adds a test for this case, and a possible
 fix.  The added test passes on 1.0 and the current 1.0.X branch, fails on
 current trunk, and passes with the fix.  The fix is to simply restore the
 old `save_form_data` method override that existed in !FileField before
 r9766.  I really have no idea if that is correct or appropriate, so review
 from someone with a clue in this area would be appreciated.  (The entire
 test suite does pass with the restored `save_form_data` method, so if its
 removal was necessary for something added in r9766 that doesn't appear to
 be fully tested by the tests added there.)
 >
 > Once this is fixed, we're left with the situation that once you have set
 a value to a blank=True !FileField, there is no way with a vanilla
 !ModelForm to set it back to blank, since if you just don't supply a file
 in the POST data the old value is used.  But that is the way things used
 to be and seems to be a lesser evil than requiring re-upload of existing
 files in order to edit any other field in a model instance without losing
 the file setting.  (#7048 looks to cover being able to "re-blank"
 !FileFields in admin, but I don't know if the solution being investigated
 there provides a general answer for !ModelFields or if it is admin-
 specific.)

 I think all these tickets (#10121, #10125, #7048) shows us that simply
 using standard browser widget for file uploads isn't a perfectly suitable
 for concepts like those behind ImageField and FileField.

 That is the file upload widget is good for, well, uploading a file. But
 guessing whether the formerly uploaded file or image must be automatically
 deleted or kept is a work for an additional control (a checkbox obviosly).
 So, the FileField/ImageField must be presented with upload widget and
 checkbox simultaneously. Not sure though if current Django version
 supports multiple form elements for single database field.

-- 
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] #10255: FileField overwrite existing value with empty one

2009-02-16 Thread Django
#10255: FileField overwrite existing value with empty one
---+
  Reporter:  pierpaolodf   | Owner:  nobody   
Status:  closed| Milestone:   
 Component:  django.contrib.admin  |   Version:  SVN  
Resolution:  duplicate |  Keywords:  FileField
 Stage:  Unreviewed| Has_patch:  0
Needs_docs:  0 |   Needs_tests:  0
Needs_better_patch:  0 |  
---+
Comment (by Valera Grishin):

 Replying to [comment:5 anonymous]:
 Ok, thanks for explanation. I'm removing my e-mail from cc then.

-- 
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] #10255: FileField overwrite existing value with empty one

2009-02-16 Thread Django
#10255: FileField overwrite existing value with empty one
---+
  Reporter:  pierpaolodf   | Owner:  nobody   
Status:  closed| Milestone:   
 Component:  django.contrib.admin  |   Version:  SVN  
Resolution:  duplicate |  Keywords:  FileField
 Stage:  Unreviewed| Has_patch:  0
Needs_docs:  0 |   Needs_tests:  0
Needs_better_patch:  0 |  
---+
Changes (by anonymous):

 * cc: valera.gris...@gmail.com (removed)

-- 
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] #10263: order_by parameter for inlineformset_factory and BaseInlineFormSet

2009-02-16 Thread Django
#10263: order_by parameter for inlineformset_factory and BaseInlineFormSet
-+--
  Reporter:  Paulo Scardine   | Owner:  
nobody  
Status:  new | Milestone:   
   
 Component:  Forms   |   Version:  
1.0 
Resolution:  |  Keywords:  
inlineformset_factory BaseInlineFormSet inline model formset
 Stage:  Unreviewed  | Has_patch:  
1   
Needs_docs:  0   |   Needs_tests:  
0   
Needs_better_patch:  0   |  
-+--
Changes (by carljm):

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

Comment:

 Related: #9758, #9006.

-- 
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] #10262: Allow to clear object before deleting to avoid data loss because delete cascade behaviour

2009-02-16 Thread Django
#10262: Allow to clear object before deleting to avoid data loss because delete
cascade behaviour
---+
  Reporter:  msaelices | Owner:  nobody
Status:  new   | Milestone:
 Component:  Database layer (models, ORM)  |   Version:  1.0   
Resolution:|  Keywords:
 Stage:  Design decision needed| Has_patch:  1 
Needs_docs:  1 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by carljm):

 * cc: carljm (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-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] #6108: send all_objects_to_be_deleted in the pre_delete signal

2009-02-16 Thread Django
#6108: send all_objects_to_be_deleted in the pre_delete signal
--+-
  Reporter:  Gábor Farkas   | Owner:  
nobody
Status:  new  | Milestone:  
  
 Component:  Core framework   |   Version:  SVN 
  
Resolution:   |  Keywords:  
  
 Stage:  Design decision needed   | Has_patch:  1   
  
Needs_docs:  0|   Needs_tests:  0   
  
Needs_better_patch:  1|  
--+-
Changes (by carljm):

 * cc: carljm (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-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] #10271: Models with multiple inlines inheriting from the same parent class do not save properly in admin

2009-02-16 Thread Django
#10271: Models with multiple inlines inheriting from the same parent class do 
not
save properly in admin
---+
  Reporter:  idangazit | Owner:  nobody
Status:  new   | Milestone:
 Component:  django.contrib.admin  |   Version:  1.0   
Resolution:|  Keywords:
 Stage:  Unreviewed| Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by idangazit):

  * needs_tests:  1 => 0

Comment:

 Added tests which checks that distinct data entered on inlines are
 captured correctly.

 This test will work going forward but will throw an error on an unpatched
 django because (as Alex points out above) the field names have changed. I
 don't know if this is "good enough" or if I should write more tests --
 guidance please!

-- 
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] #10168: Can't configure memcached backend to use unix socket

2009-02-16 Thread Django
#10168: Can't configure memcached backend to use unix socket
---+
  Reporter:  munhitsu  | Owner:  nobody 
Status:  closed| Milestone: 
 Component:  Cache system  |   Version:  1.0
Resolution:  wontfix   |  Keywords:  enhancement
 Stage:  Unreviewed| Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Comment (by seifert):

 Replying to [comment:3 munhitsu]:

 I use python-memcached.

-- 
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] #10248: Calling .dates on a annotated queryset gives wrong sql

2009-02-16 Thread Django
#10248: Calling .dates on a annotated queryset gives wrong sql
--+-
  Reporter:  oyvind   | Owner: 
Status:  closed   | Milestone: 
 Component:  ORM aggregation  |   Version:  SVN
Resolution:  fixed|  Keywords:  annotate dates queryset
 Stage:  Accepted | Has_patch:  1  
Needs_docs:  0|   Needs_tests:  0  
Needs_better_patch:  0|  
--+-
Comment (by russellm):

 I'm on a roll tonight - that's 2 messed up commit messages in a row.
 Apologies to Oyvind Saltvik for misattributing the original report to Alex
 in the commit message. Still giving thanks to Alex for the patch, though
 :-)

-- 
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] r9839 - in django/trunk: django/db/models/sql tests/regressiontests/aggregation_regress

2009-02-16 Thread noreply

Author: russellm
Date: 2009-02-16 06:38:11 -0600 (Mon, 16 Feb 2009)
New Revision: 9839

Modified:
   django/trunk/django/db/models/sql/query.py
   django/trunk/tests/regressiontests/aggregation_regress/models.py
Log:
Fixed #10248 -- Corrected handling of the GROUP BY clause when using a 
DateQuerySet. Thanks to Alex Gaynor for the report and patch.

Modified: django/trunk/django/db/models/sql/query.py
===
--- django/trunk/django/db/models/sql/query.py  2009-02-16 12:29:31 UTC (rev 
9838)
+++ django/trunk/django/db/models/sql/query.py  2009-02-16 12:38:11 UTC (rev 
9839)
@@ -389,7 +389,7 @@
 # other than MySQL), then any fields mentioned in the
 # ordering clause needs to be in the group by clause.
 if not self.connection.features.allows_group_by_pk:
-grouping.extend([col for col in ordering_group_by
+grouping.extend([str(col) for col in ordering_group_by
 if col not in grouping])
 else:
 ordering = self.connection.ops.force_no_ordering()

Modified: django/trunk/tests/regressiontests/aggregation_regress/models.py
===
--- django/trunk/tests/regressiontests/aggregation_regress/models.py
2009-02-16 12:29:31 UTC (rev 9838)
+++ django/trunk/tests/regressiontests/aggregation_regress/models.py
2009-02-16 12:38:11 UTC (rev 9839)
@@ -213,6 +213,10 @@
 >>> books.all()
 [, , , , , ]
 
+# Regression for #10248 - Annotations work with DateQuerySets
+>>> 
Book.objects.annotate(num_authors=Count('authors')).filter(num_authors=2).dates('pubdate',
 'day')
+[datetime.datetime(1995, 1, 15, 0, 0), datetime.datetime(2007, 12, 6, 0, 0)]
+
 """
 }
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-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] #10256: values() and values_list() either include all or no columns from the extra(select=) clause

2009-02-16 Thread Django
#10256: values() and values_list() either include all or no columns from the
extra(select=) clause
---+
  Reporter:  russellm  | Owner:  russellm
Status:  closed| Milestone:  
 Component:  Database layer (models, ORM)  |   Version:  1.0 
Resolution:  fixed |  Keywords:  
 Stage:  Accepted  | Has_patch:  0   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by russellm):

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

Comment:

 (In [9837]) Fixed #10256 -- Corrected the interaction of extra(select=)
 with values() and values_list() where an explicit list of columns is
 requested.

-- 
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] #10132: Aggregations add extra values to ValuesQuerySets

2009-02-16 Thread Django
#10132: Aggregations add extra values to ValuesQuerySets
--+-
  Reporter:  Glenn| Owner: 
Status:  closed   | Milestone: 
 Component:  ORM aggregation  |   Version:  SVN
Resolution:  fixed|  Keywords: 
 Stage:  Unreviewed   | Has_patch:  0  
Needs_docs:  0|   Needs_tests:  0  
Needs_better_patch:  0|  
--+-
Comment (by russellm):

 Apologies for misspelling your name in the commit message, Glenn.

-- 
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] r9838 - in django/trunk: django/db/models django/db/models/sql tests/regressiontests/aggregation_regress

2009-02-16 Thread noreply

Author: russellm
Date: 2009-02-16 06:29:31 -0600 (Mon, 16 Feb 2009)
New Revision: 9838

Modified:
   django/trunk/django/db/models/query.py
   django/trunk/django/db/models/sql/query.py
   django/trunk/tests/regressiontests/aggregation_regress/models.py
Log:
Fixed #10132 -- Corrected the interaction of extra() queries with the values() 
clause. Thanks to Glen Maynard for the report.

Modified: django/trunk/django/db/models/query.py
===
--- django/trunk/django/db/models/query.py  2009-02-16 12:28:37 UTC (rev 
9837)
+++ django/trunk/django/db/models/query.py  2009-02-16 12:29:31 UTC (rev 
9838)
@@ -698,7 +698,7 @@
 Prepare the query for computing a result that contains aggregate 
annotations.
 """
 opts = self.model._meta
-if not self.query.group_by:
+if self.query.group_by is None:
 field_names = [f.attname for f in opts.fields]
 self.query.add_fields(field_names, False)
 self.query.set_group_by()
@@ -736,6 +736,7 @@
 aggregate_names = self.query.aggregate_select.keys()
 
 names = extra_names + field_names + aggregate_names
+
 for row in self.query.results_iter():
 yield dict(zip(names, row))
 

Modified: django/trunk/django/db/models/sql/query.py
===
--- django/trunk/django/db/models/sql/query.py  2009-02-16 12:28:37 UTC (rev 
9837)
+++ django/trunk/django/db/models/sql/query.py  2009-02-16 12:29:31 UTC (rev 
9838)
@@ -68,7 +68,7 @@
 self.tables = []# Aliases in the order they are created.
 self.where = where()
 self.where_class = where
-self.group_by = []
+self.group_by = None
 self.having = where()
 self.order_by = []
 self.low_mark, self.high_mark = 0, None  # Used for offset/limit
@@ -177,7 +177,10 @@
 obj.tables = self.tables[:]
 obj.where = deepcopy(self.where)
 obj.where_class = self.where_class
-obj.group_by = self.group_by[:]
+if self.group_by is None:
+obj.group_by = None
+else:
+obj.group_by = self.group_by[:]
 obj.having = deepcopy(self.having)
 obj.order_by = self.order_by[:]
 obj.low_mark, obj.high_mark = self.low_mark, self.high_mark
@@ -272,7 +275,7 @@
 # If there is a group by clause, aggregating does not add useful
 # information but retrieves only the first row. Aggregate
 # over the subquery instead.
-if self.group_by:
+if self.group_by is not None:
 from subqueries import AggregateQuery
 query = AggregateQuery(self.model, self.connection)
 
@@ -379,8 +382,8 @@
 result.append('AND')
 result.append(' AND '.join(self.extra_where))
 
-if self.group_by:
-grouping = self.get_grouping()
+grouping = self.get_grouping()
+if grouping:
 if ordering:
 # If the backend can't group by PK (i.e., any database
 # other than MySQL), then any fields mentioned in the
@@ -698,13 +701,15 @@
 """
 qn = self.quote_name_unless_alias
 result = []
-for col in self.group_by + self.related_select_cols:
-if isinstance(col, (list, tuple)):
-result.append('%s.%s' % (qn(col[0]), qn(col[1])))
-elif hasattr(col, 'as_sql'):
-result.append(col.as_sql(qn))
-else:
-result.append(str(col))
+if self.group_by is not None:
+group_by = self.group_by or []
+for col in group_by + self.related_select_cols + 
self.extra_select.keys():
+if isinstance(col, (list, tuple)):
+result.append('%s.%s' % (qn(col[0]), qn(col[1])))
+elif hasattr(col, 'as_sql'):
+result.append(col.as_sql(qn))
+else:
+result.append(str(col))
 return result
 
 def get_ordering(self):
@@ -1224,7 +1229,7 @@
 # Aggregate references a normal field
 field_name = field_list[0]
 source = opts.get_field(field_name)
-if not (self.group_by and is_summary):
+if not (self.group_by is not None and is_summary):
 # Only use a column alias if this is a
 # standalone aggregate, or an annotation
 col = (opts.db_table, source.column)
@@ -1816,6 +1821,7 @@
 primary key, and the query would be equivalent, the optimization
 will be made automatically.
 """
+self.group_by = []
 if self.connection.features.allows_group_by_pk:
 if len(self.select) == len(self.model._meta.fields):
 self.group_by.append('.'.join([self.model._meta.db_table,

Modified: django/trunk/tests/regressionte

[Changeset] r9837 - in django/trunk: django/db/models tests/regressiontests/aggregation_regress tests/regressiontests/extra_regress

2009-02-16 Thread noreply

Author: russellm
Date: 2009-02-16 06:28:37 -0600 (Mon, 16 Feb 2009)
New Revision: 9837

Modified:
   django/trunk/django/db/models/query.py
   django/trunk/tests/regressiontests/aggregation_regress/models.py
   django/trunk/tests/regressiontests/extra_regress/models.py
Log:
Fixed #10256 -- Corrected the interaction of extra(select=) with values() and 
values_list() where an explicit list of columns is requested.

Modified: django/trunk/django/db/models/query.py
===
--- django/trunk/django/db/models/query.py  2009-02-16 05:14:18 UTC (rev 
9836)
+++ django/trunk/django/db/models/query.py  2009-02-16 12:28:37 UTC (rev 
9837)
@@ -727,12 +727,15 @@
 # names of the model fields to select.
 
 def iterator(self):
-if (not self.extra_names and
-len(self.field_names) != len(self.model._meta.fields)):
+# Purge any extra columns that haven't been explicitly asked for
+if self.extra_names is not None:
 self.query.trim_extra_select(self.extra_names)
-names = self.query.extra_select.keys() + self.field_names
-names.extend(self.query.aggregate_select.keys())
 
+extra_names = self.query.extra_select.keys()
+field_names = self.field_names
+aggregate_names = self.query.aggregate_select.keys()
+
+names = extra_names + field_names + aggregate_names
 for row in self.query.results_iter():
 yield dict(zip(names, row))
 
@@ -745,29 +748,30 @@
 instance.
 """
 self.query.clear_select_fields()
-self.extra_names = []
-self.aggregate_names = []
 
 if self._fields:
+self.extra_names = []
+self.aggregate_names = []
 if not self.query.extra_select and not self.query.aggregate_select:
-field_names = list(self._fields)
+self.field_names = list(self._fields)
 else:
-field_names = []
+self.query.default_cols = False
+self.field_names = []
 for f in self._fields:
 if self.query.extra_select.has_key(f):
 self.extra_names.append(f)
 elif self.query.aggregate_select.has_key(f):
 self.aggregate_names.append(f)
 else:
-field_names.append(f)
+self.field_names.append(f)
 else:
 # Default to all fields.
-field_names = [f.attname for f in self.model._meta.fields]
+self.extra_names = None
+self.field_names = [f.attname for f in self.model._meta.fields]
+self.aggregate_names = None
 
 self.query.select = []
-self.query.add_fields(field_names, False)
-self.query.default_cols = False
-self.field_names = field_names
+self.query.add_fields(self.field_names, False)
 
 def _clone(self, klass=None, setup=False, **kwargs):
 """
@@ -817,7 +821,8 @@
 
 class ValuesListQuerySet(ValuesQuerySet):
 def iterator(self):
-self.query.trim_extra_select(self.extra_names)
+if self.extra_names is not None:
+self.query.trim_extra_select(self.extra_names)
 if self.flat and len(self._fields) == 1:
 for row in self.query.results_iter():
 yield row[0]
@@ -825,13 +830,24 @@
 for row in self.query.results_iter():
 yield tuple(row)
 else:
-# When extra(select=...) is involved, the extra cols come are
-# always at the start of the row, so we need to reorder the fields
+# When extra(select=...) or an annotation is involved, the extra 
cols are
+# always at the start of the row, and we need to reorder the fields
 # to match the order in self._fields.
-names = self.query.extra_select.keys() + self.field_names + 
self.query.aggregate_select.keys()
+extra_names = self.query.extra_select.keys()
+field_names = self.field_names
+aggregate_names = self.query.aggregate_select.keys()
+names = extra_names + field_names + aggregate_names
+
+# If a field list has been specified, use it. Otherwise, use the
+# full list of fields, including extras and aggregates.
+if self._fields:
+fields = self._fields
+else:
+fields = names
+
 for row in self.query.results_iter():
 data = dict(zip(names, row))
-yield tuple([data[f] for f in self._fields])
+yield tuple([data[f] for f in fields])
 
 def _clone(self, *args, **kwargs):
 clone = super(ValuesListQuerySet, self)._clone(*args, **kwargs)

Modified: django/trunk/tests/regressiontests/aggregation_regress/models.py
===

[Django] #10275: Inconsistency between django.contrib.admin.models.LogEntry interface and index.html admin template

2009-02-16 Thread Django
#10275: Inconsistency between django.contrib.admin.models.LogEntry interface and
index.html admin template
--+-
 Reporter:  zgoda |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  django.contrib.admin  | Version:  SVN   
 Keywords:  log   |   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 This inconsistency lies in fact that `LogEntry` model allows for
 `content_type` (and `object_id`) to be `None` (both attributes are defined
 as `blank=True, null=True`). This causes admin index page failing to
 render in line 62 of index.html template, which implicitly requires
 content type to be set: `{% filter capfirst %}{% trans
 entry.content_type.name %}{% endfilter %}`.

 {{{
 Caught an exception while rendering: Failed lookup for key [name] in
 u'None'
 Original Traceback (most recent call last):
 File "/usr/lib/python2.5/site-packages/django/template/debug.py", line 71,
 in render_node
 result = node.render(context)
 File "/usr/lib/python2.5/site-packages/django/templatetags/i18n.py", line
 42, in render
 value = self.value.resolve(context)
 File "/usr/lib/python2.5/site-packages/django/template/__init__.py", line
 676, in resolve
 value = self._resolve_lookup(context)
 File "/usr/lib/python2.5/site-packages/django/template/__init__.py", line
 729, in _resolve_lookup
 raise VariableDoesNotExist("Failed lookup for key [%s] in %r", (bit,
 current)) # missing attribute
 VariableDoesNotExist: Failed lookup for key [name] in u'None'
 }}}

-- 
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] #10168: Can't configure memcached backend to use unix socket

2009-02-16 Thread Django
#10168: Can't configure memcached backend to use unix socket
---+
  Reporter:  munhitsu  | Owner:  nobody 
Status:  closed| Milestone: 
 Component:  Cache system  |   Version:  1.0
Resolution:  wontfix   |  Keywords:  enhancement
 Stage:  Unreviewed| Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Comment (by munhitsu):

 Replying to [comment:2 seifert]:

 Which python memcached module are you using?

-- 
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] #10274: BaseGenericInlineFormSet.get_queryset calls .empty()

2009-02-16 Thread Django
#10274: BaseGenericInlineFormSet.get_queryset calls .empty()
---+
 Reporter:  Zak Johnson   |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Contrib apps   | Version:  SVN   
 Keywords: |   Stage:  Unreviewed
Has_patch:  1  |  
---+
 In BaseGenericInlineFormSet.get_queryset():

 {{{
 if self.instance is None:
 return self.model._default_manager.empty()
 }}}

 Managers don't have an `empty()` method; this should instead be
 `get_empty_query_set()`.  Attached patch (against trunk revision 9836)
 includes a doctest to illustrate 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] #10168: Can't configure memcached backend to use unix socket

2009-02-16 Thread Django
#10168: Can't configure memcached backend to use unix socket
---+
  Reporter:  munhitsu  | Owner:  nobody 
Status:  closed| Milestone: 
 Component:  Cache system  |   Version:  1.0
Resolution:  wontfix   |  Keywords:  enhancement
 Stage:  Unreviewed| Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Comment (by seifert):

 Try:

 {{{
 CACHE_BACKEND = 'memcached://unix:memcached.sock'
 }}}


 I use:

 {{{
 memcached -u nobody -s /tmp/memcached.sock -a 0777
 }}}

 My settings.py:

 {{{
 CACHE_BACKEND = 'memcached://unix:/tmp/memcached.sock'
 }}}

 It works.

-- 
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] #6108: send all_objects_to_be_deleted in the pre_delete signal

2009-02-16 Thread Django
#6108: send all_objects_to_be_deleted in the pre_delete signal
--+-
  Reporter:  Gábor Farkas   | Owner:  
nobody
Status:  new  | Milestone:  
  
 Component:  Core framework   |   Version:  SVN 
  
Resolution:   |  Keywords:  
  
 Stage:  Design decision needed   | Has_patch:  1   
  
Needs_docs:  0|   Needs_tests:  0   
  
Needs_better_patch:  1|  
--+-
Comment (by gabor):

 if anyone is planning to use above-mentioned code-snippet, please note,
 that for django-1.0 it has to be changed slightly:

 {{{
 def delete(self):
 from django.db.models.query import CollectedObjects
 s = CollectedObjects()
 self._collect_sub_objects(s)
 #here s will contain all the objects that are planned to be deleted
 if s.items() == [(type(u), { u.pk : u })]:
 super(YourModel, self).delete()
 else:
 raise Exception("related objects found")
 }}}

 yes, this is a good example of why not to use private undocumented methods
 (because they might change between versions...)

-- 
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] #10165: Honor TEST_RUNNER setting on runtests.py

2009-02-16 Thread Django
#10165: Honor TEST_RUNNER setting on runtests.py
+---
  Reporter:  leosoto| Owner: 
Status:  new| Milestone: 
 Component:  Testing framework  |   Version:  1.0
Resolution: |  Keywords: 
 Stage:  Accepted   | Has_patch:  1  
Needs_docs:  0  |   Needs_tests:  0  
Needs_better_patch:  0  |  
+---
Changes (by ericholscher):

  * stage:  Unreviewed => Accepted

Comment:

 Triage fail.

-- 
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] #10165: Honor TEST_RUNNER setting on runtests.py

2009-02-16 Thread Django
#10165: Honor TEST_RUNNER setting on runtests.py
+---
  Reporter:  leosoto| Owner: 
Status:  new| Milestone: 
 Component:  Testing framework  |   Version:  1.0
Resolution: |  Keywords: 
 Stage:  Unreviewed | Has_patch:  1  
Needs_docs:  0  |   Needs_tests:  0  
Needs_better_patch:  0  |  
+---
Changes (by ericholscher):

  * owner:  ericholscher =>
  * status:  assigned => new

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-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] #10165: Honor TEST_RUNNER setting on runtests.py

2009-02-16 Thread Django
#10165: Honor TEST_RUNNER setting on runtests.py
+---
  Reporter:  leosoto| Owner:  ericholscher
Status:  assigned   | Milestone:  
 Component:  Testing framework  |   Version:  1.0 
Resolution: |  Keywords:  
 Stage:  Unreviewed | Has_patch:  1   
Needs_docs:  0  |   Needs_tests:  0   
Needs_better_patch:  0  |  
+---
Changes (by ericholscher):

  * owner:  nobody => ericholscher
  * status:  new => assigned

Comment:

 Seems like a good idea. Marketing as 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
-~--~~~~--~~--~--~---