Re: [Django] #29148: Explain how to use QuerySet.get_or_create() with Q objects

2018-03-28 Thread Django
#29148: Explain how to use QuerySet.get_or_create() with Q objects
---+---
 Reporter:  Mike Lissner   |Owner:  Dhruv Singh
 Type:  New feature|   Status:  closed
Component:  Documentation  |  Version:  2.0
 Severity:  Normal |   Resolution:  fixed
 Keywords: | Triage Stage:  Accepted
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  1
Easy pickings:  1  |UI/UX:  0
---+---
Changes (by Tim Graham ):

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


Comment:

 In [changeset:"34c522283710c3866833134ddf1a397da03999e8" 34c52228]:
 {{{
 #!CommitTicketReference repository=""
 revision="34c522283710c3866833134ddf1a397da03999e8"
 Fixed #29148 -- Doc'd how to use get_or_create() with Q objects.
 }}}

-- 
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/066.fbe92653a6b3300be7ef840245d02ff7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29148: Explain how to use QuerySet.get_or_create() with Q objects

2018-03-16 Thread Django
#29148: Explain how to use QuerySet.get_or_create() with Q objects
---+---
 Reporter:  Mike Lissner   |Owner:  Dhruv Singh
 Type:  New feature|   Status:  assigned
Component:  Documentation  |  Version:  2.0
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  1
Easy pickings:  1  |UI/UX:  0
---+---
Changes (by Tim Graham):

 * needs_better_patch:  0 => 1


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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To 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/066.86f00630581c382f2fa506078d2c49dc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29148: Explain how to use QuerySet.get_or_create() with Q objects

2018-03-04 Thread Django
#29148: Explain how to use QuerySet.get_or_create() with Q objects
---+---
 Reporter:  Mike Lissner   |Owner:  Dhruv Singh
 Type:  New feature|   Status:  assigned
Component:  Documentation  |  Version:  2.0
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  1  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  1  |UI/UX:  0
---+---
Changes (by Herbert Fortes):

 * has_patch:  0 => 1


Comment:

 [PR](https://github.com/django/django/pull/9750)

-- 
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/066.36eafe6386bdf1b7acfe7ea786849013%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29148: Explain how to use QuerySet.get_or_create() with Q objects

2018-02-27 Thread Django
#29148: Explain how to use QuerySet.get_or_create() with Q objects
---+---
 Reporter:  Mike Lissner   |Owner:  Dhruv Singh
 Type:  New feature|   Status:  assigned
Component:  Documentation  |  Version:  2.0
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  1  |UI/UX:  0
---+---

Comment (by Herbert Fortes):

 Hi Dhruv Singh,

 Do you still intent to make a PR to close the ticket?

 I have something like this:

 Differently from :meth:`~django.db.models.query.QuerySet.get` method, the
 :meth:`~django.db.models.query.QuerySet.get_or_create` method must be used
 with the :meth:`~django.db.models.query.QuerySet.filter` lookup function.
 For example::

 Poll.objects.filter(
 Q(first_name='Bryan') | Q(first_name='Bruce')
 ).get_or_create({'last_name': 'Harrison'})

-- 
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/066.ccb5822bb473bd635b88e8350e12c2e2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29148: Explain how to use QuerySet.get_or_create() with Q objects

2018-02-25 Thread Django
#29148: Explain how to use QuerySet.get_or_create() with Q objects
---+---
 Reporter:  Mike Lissner   |Owner:  Dhruv Singh
 Type:  New feature|   Status:  assigned
Component:  Documentation  |  Version:  2.0
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  1  |UI/UX:  0
---+---
Changes (by Herbert Fortes):

 * cc: Herbert Fortes (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 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/066.b070f8b20f90a1c32533053de66570e8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29148: Explain how to use QuerySet.get_or_create() with Q objects

2018-02-25 Thread Django
#29148: Explain how to use QuerySet.get_or_create() with Q objects
---+---
 Reporter:  Mike Lissner   |Owner:  Dhruv Singh
 Type:  New feature|   Status:  assigned
Component:  Documentation  |  Version:  2.0
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  1  |UI/UX:  0
---+---

Comment (by Herbert Fortes):

 I think a good place to put an example is on 'Complex lookups with Q
 objects' .

 There has explanation on how use it with "...lookup functions that takes
 keyword-arguments (e.g. filter(), exclude(), get())..."

-- 
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/066.992260e0d53ef2b2f1086506d46f53c0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29148: Explain how to use QuerySet.get_or_create() with Q objects

2018-02-21 Thread Django
#29148: Explain how to use QuerySet.get_or_create() with Q objects
---+---
 Reporter:  Mike Lissner   |Owner:  Dhruv Singh
 Type:  New feature|   Status:  assigned
Component:  Documentation  |  Version:  2.0
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  1  |UI/UX:  0
---+---
Changes (by Dhruv Singh):

 * status:  new => assigned
 * cc: Dhruv Singh (added)
 * owner:  nobody => Dhruv Singh


Comment:

 Trying to start to give my bit to the open source community.
 This feels like a good small starting step.
 As the description of the ticket suggests, will add an example of using Q
 objects with get_or_create().
 Please suggest if something else is needed.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To 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/066.affaea769946181a31cb808f45359c62%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29148: Explain how to use QuerySet.get_or_create() with Q objects (was: Add filter().get_or_create() chaining to documentation to explain how to use get_or_create with Q objects)

2018-02-21 Thread Django
#29148: Explain how to use QuerySet.get_or_create() with Q objects
---+
 Reporter:  Mike Lissner   |Owner:  nobody
 Type:  New feature|   Status:  new
Component:  Documentation  |  Version:  2.0
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  1  |UI/UX:  0
---+
Changes (by Tim Graham):

 * stage:  Unreviewed => Accepted


Old description:

> This technique is useful if you want to use Q objects in conjunction with
> the get or create method, and it's documented in a few places around the
> web.
>
> I brought this up in the forums yesterday and somebody suggested that it
> be documented:
>
> https://groups.google.com/forum/?utm_medium=email_source=footer#!msg
> /django-developers/e3sJ6OiHEd0/Yrg-Z9uRAgAJ
>
> I gave this a try, but I don't understand the documentation system and I
> sadly don't have time to figure it out. Seems though like a change could
> go here:
>
> https://github.com/django/django/blob/master/docs/ref/models/querysets.txt#L1886
>
> I think something along the lines of:
>
> > get_or_create() can be used with Q objects by chaining them together
> like so:
>
> > An example
>
> > When this is done, the logic performs as above, but matches are made
> according to the query in the Q object.
>
> I imagine this also works for update_or_create, but I'm not sure how to
> document that too. Maybe just a quick mention:
>
> > update_or_create() can be used with Q objects using the same technique
> as documented above for get_or_create()

New description:

 This technique is useful if you want to use Q objects in conjunction with
 the get or create method, and it's documented in a few places around the
 web.

 I brought this up in the forums yesterday and somebody suggested that it
 be documented:

 https://groups.google.com/forum/?utm_medium=email_source=footer#!msg
 /django-developers/e3sJ6OiHEd0/Yrg-Z9uRAgAJ

 I gave this a try, but I don't understand the documentation system and I
 sadly don't have time to figure it out. Seems though like a change could
 go here:

 
https://github.com/django/django/blob/master/docs/ref/models/querysets.txt#L1886

 I think something along the lines of:

 > get_or_create() can be used with Q objects by chaining them together
 like so:
 >
 > An example
 >
 > When this is done, the logic performs as above, but matches are made
 according to the query in the Q object.

 I imagine this also works for update_or_create, but I'm not sure how to
 document that too. Maybe just a quick mention:

 > update_or_create() can be used with Q objects using the same technique
 as documented above for get_or_create()

--

-- 
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/066.5f305a768f8b900a620b5679d1abdbed%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.