Re: [Django] #30019: Add __class_getitem__ method to managers and querysets

2018-12-20 Thread Django
#30019: Add __class_getitem__ method to managers and querysets
-+-
 Reporter:  Maxim Kurnikov   |Owner:  Greg W
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-

Comment (by Tim Graham):

 (And #29299 is the Someday/Maybe ticket for adding type hints and variable
 annotations.)

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


Re: [Django] #30019: Add __class_getitem__ method to managers and querysets

2018-12-12 Thread Django
#30019: Add __class_getitem__ method to managers and querysets
-+-
 Reporter:  Maxim Kurnikov   |Owner:  Greg W
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Carlton Gibson):

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


Comment:

 Hi Maxim.

 I'm going to close this as needsinfo right now. Not because I'm against it
 but because it's part of the wider discussion around Type Hinting in
 Django.


 I see you posted to the Django-Developers thread about this:
 https://groups.google.com/d/topic/django-developers/trTEbURFhEY/discussion

 Can I ask you to add your effort there? I think there's a group of people
 who are there or there-abouts with this: as ever, it just needs a bit of a
 nudge.
 (There was talk of a DEP, of a working groups, of... — we just need to get
 there.)

 Thanks.

 I'll post there to try and re-liven it.

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

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


Re: [Django] #30019: Add __class_getitem__ method to managers and querysets

2018-12-11 Thread Django
#30019: Add __class_getitem__ method to managers and querysets
-+-
 Reporter:  Maxim Kurnikov   |Owner:  Greg W
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-

Comment (by Greg W):

 I got {{{ __class_getitem__}}}  implemented.  However, I am having an
 issue with {{{models.Manager['User']}}}

 Isn't {{{'User'}}} just a string which {{{__class_getitem__}}} would not
 be valid on?  I think the idea is to index the class User, but this class
 has not been defined prior to {{{Manager[User]}}}.

 Let me know if I am off base.

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


Re: [Django] #30019: Add __class_getitem__ method to managers and querysets

2018-12-10 Thread Django
#30019: Add __class_getitem__ method to managers and querysets
-+-
 Reporter:  Maxim Kurnikov   |Owner:  Greg
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
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/067.d2a83e327592228db80adf22e92453a9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #30019: Add __class_getitem__ method to managers and querysets

2018-12-08 Thread Django
#30019: Add __class_getitem__ method to managers and querysets
-+-
 Reporter:  Maxim Kurnikov   |Owner:  Greg
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-

Comment (by Maxim Kurnikov):

 {{{TypeError: 'type' object is not subscriptable}}}

 Look at
 https://www.python.org/dev/peps/pep-0560/#class-getitem

 and how it was implemented before with {{{GenericMeta}}}
 https://www.python.org/dev/peps/pep-0484/#user-defined-generic-types

 Minimal repro should be this one
 {{{
 from django.db import models

 class UserManager(models.Manager['User']):
 pass

 class User(models.Model):
 objects = UserManager()
 }}}

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


Re: [Django] #30019: Add __class_getitem__ method to managers and querysets

2018-12-07 Thread Django
#30019: Add __class_getitem__ method to managers and querysets
-+-
 Reporter:  Maxim Kurnikov   |Owner:  Greg
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-

Comment (by Greg):

 Is this the error you are getting:

 NameError: name 'User' is not defined

 If not, can you please let me know what the error is?

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


Re: [Django] #30019: Add __class_getitem__ method to managers and querysets

2018-12-07 Thread Django
#30019: Add __class_getitem__ method to managers and querysets
-+-
 Reporter:  mkurnikov|Owner:  Greg
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Greg):

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


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


[Django] #30019: Add __class_getitem__ method to managers and querysets

2018-12-07 Thread Django
#30019: Add __class_getitem__ method to managers and querysets
-+-
   Reporter:  mkurnikov  |  Owner:  nobody
   Type:  New| Status:  new
  feature|
  Component:  Database   |Version:  master
  layer (models, ORM)|
   Severity:  Normal |   Keywords:
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  1
  UI/UX:  0  |
-+-
 I'm working on a pep561 stubs package for Django here
 https://github.com/mkurnikov/django-stubs

 In order to be able to fully support managers as a generics, one needs to
 write
 {{{

 from django.db import models

 class UserManager(models.Manager[User]):
 def get_or_404(self) -> User:
 pass

 class User(models.Model):
 objects = UserManager()
 }}}
 but it fails at {{{ models.Manager[User] }}}.

 There's a new method {{{ __class_getitem__ }}} in python3.7 to get around
 that, defined in pep560
 https://www.python.org/dev/peps/pep-0560/

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