Re: [Django] #2316: GenericRelation and get_or_create do not work together

2020-10-02 Thread Django
#2316: GenericRelation and get_or_create do not work together
-+-
 Reporter:  Rudolph Froger   |Owner:  Adrian
 |  Holovaty
 Type:  Bug  |   Status:  closed
Component:   |  Version:  master
  contrib.contenttypes   |
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:  GenericRelation  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by felixxm):

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


Comment:

 Fixed in ed37f7e979186c99a6f351c289eb486461601d80.

 Duplicate of #23611.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.5a1e14fd2b4c4af5136abb05524a2091%40djangoproject.com.


Re: [Django] #2316: GenericRelation and get_or_create do not work together

2015-11-23 Thread Django
#2316: GenericRelation and get_or_create do not work together
--+
 Reporter:  Rudolph   |Owner:  adrian
 Type:  Bug   |   Status:  new
Component:  contrib.contenttypes  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:  GenericRelation   | Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by auvipy):

 * version:  1.2 => master


--
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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.9888a146e1acaa87195970bd830a8a93%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #2316: GenericRelation and get_or_create do not work together

2013-08-26 Thread Django
#2316: GenericRelation and get_or_create do not work together
--+
 Reporter:  Rudolph   |Owner:  adrian
 Type:  Bug   |   Status:  new
Component:  contrib.contenttypes  |  Version:  1.2
 Severity:  Normal|   Resolution:
 Keywords:  GenericRelation   | Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by anonymous):

 well i want to check if its good for my needs

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.763062fd36fc51971421c22c7d49d33b%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #2316: GenericRelation and get_or_create do not work together

2011-02-21 Thread Django
#2316: GenericRelation and get_or_create do not work together
+---
   Reporter:  Rudolph   | Owner:  adrian 
 Status:  reopened  | Milestone:  1.3
  Component:  Contrib apps  |   Version:  1.2
 Resolution:|  Keywords:  GenericRelation
   Triage Stage:  Accepted  | Has patch:  0  
Needs documentation:  0 |   Needs tests:  0  
Patch needs improvement:  0 |  
+---
Changes (by lukeplant):

  * has_patch:  1 => 0


Comment:

 The attached patch does not address the original problem, as can be seen
 if you change this line in the added test:
 {{{
 #!python
fatty = TaggedItem.objects.create(content_object=bacon, tag="fatty")
 }}}

 to:

 {{{
 #!python
fatty = TaggedItem.objects.get_or_create(content_object=bacon,
 tag="fatty")
 }}}

 The patch fixes a related problem, which is probably worthy of fixing on
 its own, although the original bug title would cover both cases.

 The original bug would probably require patching core, or we might want to
 wait until core has support for virtual/composite fields and
 `GenericRelations` could be re-worked to use that support.

 So, the most recent patch needs to be put into a new ticket if it is to be
 included on its own. So I'm marking *this* ticket as having no patch.

 Sorry for the ticket-churn, but it's needed to keep things sane. Thanks.

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

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



Re: [Django] #2316: GenericRelation and get_or_create do not work together

2010-11-24 Thread Django
#2316: GenericRelation and get_or_create do not work together
---+
  Reporter:  Rudolph   | Owner:  adrian 
Status:  reopened  | Milestone:  1.3
 Component:  Contrib apps  |   Version:  1.2
Resolution:|  Keywords:  GenericRelation
 Stage:  Accepted  | Has_patch:  1  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by henriquebastos):

  * needs_tests:  1 => 0

Comment:

 Just updated the patch to the current state of the ORM and added some
 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-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #2316: GenericRelation and get_or_create do not work together

2010-05-18 Thread Django
#2316: GenericRelation and get_or_create do not work together
---+
  Reporter:  Rudolph   | Owner:  adrian 
Status:  reopened  | Milestone:  1.3
 Component:  Contrib apps  |   Version:  1.2
Resolution:|  Keywords:  GenericRelation
 Stage:  Accepted  | Has_patch:  1  
Needs_docs:  0 |   Needs_tests:  1  
Needs_better_patch:  0 |  
---+
Changes (by Alex):

  * component:  Core framework => Contrib apps

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

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



Re: [Django] #2316: GenericRelation and get_or_create do not work together

2010-05-18 Thread Django
#2316: GenericRelation and get_or_create do not work together
-+--
  Reporter:  Rudolph | Owner:  adrian 
Status:  reopened| Milestone:  1.3
 Component:  Core framework  |   Version:  1.2
Resolution:  |  Keywords:  GenericRelation
 Stage:  Accepted| Has_patch:  1  
Needs_docs:  0   |   Needs_tests:  1  
Needs_better_patch:  0   |  
-+--
Comment (by kmtracey):

 Replying to [comment:9 jonozzz]:
 Note it's not necessary to change version to a higher number when releases
 go out. The version field is supposed to reflect what version of code was
 in use when the problem was reported (or the feature requested). When
 accurate, it gives a clue of how old the reported behavior is; updating it
 to be a higher number is rarely correct. It is not a target release for
 fixing the problem/implementing the feature: that's what milestone is for.

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

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



Re: [Django] #2316: GenericRelation and get_or_create do not work together

2010-05-18 Thread Django
#2316: GenericRelation and get_or_create do not work together
-+--
  Reporter:  Rudolph | Owner:  adrian 
Status:  reopened| Milestone:  1.3
 Component:  Core framework  |   Version:  1.2
Resolution:  |  Keywords:  GenericRelation
 Stage:  Accepted| Has_patch:  1  
Needs_docs:  0   |   Needs_tests:  1  
Needs_better_patch:  0   |  
-+--
Changes (by jonozzz):

  * version:  1.1 => 1.2
  * milestone:  => 1.3

Comment:

 Looks like this one missed another milestone, 1.2 is out and this totally
 legit patch didn't make it through.
 Is anyone going to submit it into the SVN ?

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

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



Re: [Django] #2316: GenericRelation and get_or_create do not work together

2010-05-18 Thread Django
#2316: GenericRelation and get_or_create do not work together
-+--
  Reporter:  Rudolph | Owner:  adrian 
Status:  reopened| Milestone: 
 Component:  Core framework  |   Version:  1.1
Resolution:  |  Keywords:  GenericRelation
 Stage:  Accepted| Has_patch:  1  
Needs_docs:  0   |   Needs_tests:  1  
Needs_better_patch:  0   |  
-+--
Changes (by jonozzz):

 * cc: jonozzz (added)

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

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



Re: [Django] #2316: GenericRelation and get_or_create do not work together

2010-05-08 Thread Django
#2316: GenericRelation and get_or_create do not work together
-+--
  Reporter:  Rudolph | Owner:  adrian 
Status:  reopened| Milestone: 
 Component:  Core framework  |   Version:  1.1
Resolution:  |  Keywords:  GenericRelation
 Stage:  Accepted| Has_patch:  1  
Needs_docs:  0   |   Needs_tests:  1  
Needs_better_patch:  0   |  
-+--
Changes (by wam):

  * status:  closed => reopened
  * version:  SVN => 1.1
  * resolution:  duplicate =>

Comment:

 This bug is neither a duplicate nor has it been fixed. Using Django 1.1.1,
 the issue still persists, as demonstrated by:

 {{{
 # Model definition for app ticket2316 demonstrating bug #2316
 from django.db import models
 from django.contrib.contenttypes.models import ContentType
 from django.contrib.contenttypes import generic

 class SomeObject(models.Model):
 test_content_type = models.ForeignKey(ContentType, null=True,
 blank=True)
 test_object_id = models.PositiveIntegerField(null=True, blank=True)
 test_object = generic.GenericForeignKey('test_content_type',
 'test_object_id')

 }}}

 After the customary syncdb, etc:

 {{{
 >>> from ticket2316.models import SomeObject
 >>> from  django.contrib.auth.models import User
 >>> User.objects.all()[0]
 
 >>> user = _
 >>> SomeObject(test_object=user)
 
 >>> SomeObject.objects.get_or_create(test_object=user)
 
 Traceback (most recent call last):
   File "", line 1, in 
   File "/home/wam/projs/virtualenvs/demo/lib/python2.6/site-
 packages/Django-1.1.1-py2.6.egg/django/db/models/manager.py", line 123, in
 get_or_create
 return self.get_query_set().get_or_create(**kwargs)
   File "/home/wam/projs/virtualenvs/demo/lib/python2.6/site-
 packages/Django-1.1.1-py2.6.egg/django/db/models/query.py", line 328, in
 get_or_create
 return self.get(**kwargs), False
   File "/home/wam/projs/virtualenvs/demo/lib/python2.6/site-
 packages/Django-1.1.1-py2.6.egg/django/db/models/query.py", line 299, in
 get
 clone = self.filter(*args, **kwargs)
   File "/home/wam/projs/virtualenvs/demo/lib/python2.6/site-
 packages/Django-1.1.1-py2.6.egg/django/db/models/query.py", line 498, in
 filter
 return self._filter_or_exclude(False, *args, **kwargs)
   File "/home/wam/projs/virtualenvs/demo/lib/python2.6/site-
 packages/Django-1.1.1-py2.6.egg/django/db/models/query.py", line 516, in
 _filter_or_exclude
 clone.query.add_q(Q(*args, **kwargs))
   File "/home/wam/projs/virtualenvs/demo/lib/python2.6/site-
 packages/Django-1.1.1-py2.6.egg/django/db/models/sql/query.py", line 1675,
 in add_q
 can_reuse=used_aliases)
   File "/home/wam/projs/virtualenvs/demo/lib/python2.6/site-
 packages/Django-1.1.1-py2.6.egg/django/db/models/sql/query.py", line 1569,
 in add_filter
 negate=negate, process_extras=process_extras)
   File "/home/wam/projs/virtualenvs/demo/lib/python2.6/site-
 packages/Django-1.1.1-py2.6.egg/django/db/models/sql/query.py", line 1737,
 in setup_joins
 "Choices are: %s" % (name, ", ".join(names)))
 : Cannot resolve keyword
 'test_object' into field. Choices are: id, test_content_type,
 test_object_id
 }}}

 I'll try and work up a more formal unittest in the near future.

 P.S. I don't exactly know how I should change the properties, considering
 this ticket has remained dormant for the past two years. I considered
 filing a new ticket, but the problem is *exactly* the failure condition
 this ticket was originally opened to address, it just appears the ticket
 got diverted onto a tangent with a similar, but not identical ticket that
 the original poster may have been experiencing as well.

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

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



Re: [Django] #2316: GenericRelation and get_or_create do not work together

2007-01-07 Thread Django

#2316: GenericRelation and get_or_create do not work together
-+--
Reporter:  Rudolph  |Owner:  adrian 
Type:  defect   |   Status:  new
Priority:  normal   |Milestone:  Version 1.0
Component:  Admin interface  |  Version:  SVN
Severity:  normal   |   Resolution: 
Keywords:   |  
-+--

Comment (by David Danier <[EMAIL PROTECTED]>):

If I see this right this does not work with any operation (get, filter,
exclude, ...) and is so far not intended to be used this way.
(I think this bug targets models.GenericForeignKey, as there is no code-
example provided)

Ugly workaround (thats the reason I posted in the first place ;-):
from django.contrib.contenttypes.models import ContentType
baz =
Bar.objects.get_or_create(content_type=ContentType.objects.get_for_model(foo.__class__),
object_id=getattr(foo, foo.__class__._meta.pk.column))

Somehow nicer (but unflexible in this form):
def do_generic_stuff(func, obj):
from django.contrib.contenttypes.models import ContentType
content_type = ContentType.objects.get_for_model(obj.__class__)
object_id = getattr(obj, obj.__class__._meta.pk.column)
return func(content_type=content_type, object_id=object_id)
# call:
baz = do_generic_stuff(Bar.objects.get_or_create, foo)

--
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---