Re: [Django] #10953: Proxy model of a proxy model is of incorrect type.

2009-05-10 Thread Django
#10953: Proxy model of a proxy model is of incorrect type.
---+
  Reporter:  mrmachine | Owner:  jacob  
   
Status:  assigned  | Milestone:  1.1
   
 Component:  Database layer (models, ORM)  |   Version:  SVN
   
Resolution:|  Keywords:  proxy type 
foreign key
 Stage:  Accepted  | Has_patch:  1  
   
Needs_docs:  0 |   Needs_tests:  0  
   
Needs_better_patch:  0 |  
---+
Changes (by jacob):

  * owner:  mitsuhiko => jacob
  * status:  new => assigned

-- 
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] #10953: Proxy model of a proxy model is of incorrect type.

2009-05-08 Thread Django
#10953: Proxy model of a proxy model is of incorrect type.
---+
  Reporter:  mrmachine | Owner:  mitsuhiko  
   
Status:  new   | Milestone:  1.1
   
 Component:  Database layer (models, ORM)  |   Version:  SVN
   
Resolution:|  Keywords:  proxy type 
foreign key
 Stage:  Accepted  | Has_patch:  1  
   
Needs_docs:  0 |   Needs_tests:  0  
   
Needs_better_patch:  0 |  
---+
Changes (by mitsuhiko):

  * owner:  nobody => mitsuhiko

Comment:

 The fix for this ticket, including the one for #10955 which is related is
 attached to my github repo:
 http://github.com/mitsuhiko/django/tree/ticket-10953

-- 
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] #10953: Proxy model of a proxy model is of incorrect type.

2009-04-28 Thread Django
#10953: Proxy model of a proxy model is of incorrect type.
---+
  Reporter:  mrmachine | Owner:  nobody 
   
Status:  new   | Milestone:  1.1
   
 Component:  Database layer (models, ORM)  |   Version:  SVN
   
Resolution:|  Keywords:  proxy type 
foreign key
 Stage:  Accepted  | Has_patch:  1  
   
Needs_docs:  0 |   Needs_tests:  0  
   
Needs_better_patch:  0 |  
---+
Changes (by Alex):

  * has_patch:  0 => 1
  * stage:  Unreviewed => Accepted
  * 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] #10953: Proxy model of a proxy model is of incorrect type.

2009-04-28 Thread Django
#10953: Proxy model of a proxy model is of incorrect type.
---+
  Reporter:  mrmachine | Owner:  nobody 
   
Status:  new   | Milestone: 
   
 Component:  Database layer (models, ORM)  |   Version:  SVN
   
Resolution:|  Keywords:  proxy type 
foreign key
 Stage:  Unreviewed| Has_patch:  0  
   
Needs_docs:  0 |   Needs_tests:  0  
   
Needs_better_patch:  0 |  
---+
Changes (by mrmachine):

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

Comment:

 Looks like the incorrect model is being assigned to the manager (or simply
 being copied unchanged from the base proxy class). This causes any
 querysets from the manager to create model objects of the wrong type.

 {{{
 >>> User1.objects.model
 
 >>> User2.objects.model
 
 }}}

-- 
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] #10953: Proxy model of a proxy model is of incorrect type.

2009-04-28 Thread Django
#10953: Proxy model of a proxy model is of incorrect type.
--+-
 Reporter:  mrmachine |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  Database layer (models, ORM)  | Version:  SVN   
 Keywords:  proxy type foreign key|   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 If you proxy a model that is already a proxy, it will be of the same type
 as the first proxy. If the second proxy is used in a foreign key, you will
 not be able to create any model objects which have a value for that
 foreign key because they will fail the type check validation.

 This means we can only ever proxy actual models, and cannot create a base
 proxy model to subclass as necessary.

 {{{
 # models.

 from django.contrib.auth import models as auth_models
 from django.db import models

 class User1(auth_models.User):
 class Meta:
 proxy = True

 class User2(User1):
 class Meta:
 proxy = True

 class Something(models.Model):
 user = models.ForeignKey(User2)

 # interactive shell.

 >>> from myapp.models import User1, User2, Something

 >>> type(User1.objects.get(username='admin'))
 

 >>> type(User2.objects.get(username='admin'))
 

 >>> Something.objects.create(user=User2.objects.get(username='admin'))
 Traceback (most recent call last):
   File "", line 1, in ?
   File "/path/to/django/db/models/manager.py", line 126, in create
 return self.get_query_set().create(**kwargs)
   File "/path/to/django/db/models/query.py", line 283, in create
 obj = self.model(**kwargs)
   File "/path/to/django/db/models/base.py", line 308, in __init__
 setattr(self, field.name, rel_obj)
   File "/path/to/django/db/models/fields/related.py", line 270, in __set__
 raise ValueError('Cannot assign "%r": "%s.%s" must be a "%s"
 instance.' %
 ValueError: Cannot assign "": "Something.user" must be a
 "User2" instance.
 }}}

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