Re: [Django] #34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm being broken (404)

2022-10-03 Thread Django
#34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm 
being
broken (404)
-+-
 Reporter:  Simon Kern   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.auth |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:  auth, password,  | Triage Stage:  Accepted
  reset, passwordreset   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-

Comment (by Simon Kern):

 Thank you Tim, I was not aware that putting the PR in the initial post is
 not enough (it was in there since after my first edit). For the future:
 It's ok for me to uncheck todo flags like "Needs documentation" and "Needs
 tests" the underlying todo is done?

-- 
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/01070183a17b9efc-1a7c6344-2c17-4862-ad10-bda518c1995c-00%40eu-central-1.amazonses.com.


Re: [Django] #25617: Disallow usernames that differ only in case in UserCreationForm

2022-10-03 Thread Django
#25617: Disallow usernames that differ only in case in UserCreationForm
-+-
 Reporter:  Tim Graham   |Owner:  Paul
 Type:   |  Schilling
  Cleanup/optimization   |   Status:  assigned
Component:  contrib.auth |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  1|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

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


Comment:

 [https://github.com/django/django/pull/16103 PR]

-- 
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/01070183a1370857-e6378bd5-0603-4338-91a1-ed043ed1ef87-00%40eu-central-1.amazonses.com.


Re: [Django] #34068: `runserver 0`'s "Starting development server at " doesn't work

2022-10-03 Thread Django
#34068: `runserver 0`'s "Starting development server at " doesn't work
-+-
 Reporter:  Ruslan   |Owner:  Dhanush
  Oleksandrovich Kovtun  |
 Type:  Bug  |   Status:  assigned
Component:  Core (Management |  Version:  4.1
  commands)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  1
Easy pickings:  1|UI/UX:  1
-+-
Changes (by Mariusz Felisiak):

 * needs_tests:  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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183a1243c9b-da6f8756-7228-4aba-b2aa-c68c7a947ca1-00%40eu-central-1.amazonses.com.


Re: [Django] #34012: QuerySet.order_by() silently skips non-existing fields on related fields with Meta.ordering.

2022-10-03 Thread Django
#34012: QuerySet.order_by() silently skips non-existing fields on related fields
with Meta.ordering.
-+-
 Reporter:  Klaas van Schelven   |Owner:  David
 Type:   |  Sanders
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  4.1
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * needs_better_patch:  1 => 0
 * stage:  Accepted => Ready for checkin


-- 
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/01070183a11fde81-710e2bff-bd8e-40f8-bb28-4c8e0bdb9a65-00%40eu-central-1.amazonses.com.


Re: [Django] #34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm being broken (404)

2022-10-03 Thread Django
#34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm 
being
broken (404)
-+-
 Reporter:  Simon Kern   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.auth |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:  auth, password,  | Triage Stage:  Accepted
  reset, passwordreset   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Tim Graham):

 * needs_tests:  1 => 0


Comment:

 [https://github.com/django/django/pull/16139 PR]

 By the way, there's no need to attach your patch to the ticket, but you
 should link to the pull request. I'll do that and uncheck "Needs tests" to
 put this patch in the review queue. In the future, check "According to the
 ticket's flags" on this page for the steps to move the ticket forward.

-- 
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/010701839fecddc2-21e79d1e-7de1-4f1a-81fb-c93cd0d69a00-00%40eu-central-1.amazonses.com.


Re: [Django] #34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm being broken (404)

2022-10-03 Thread Django
#34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm 
being
broken (404)
-+-
 Reporter:  Simon Kern   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.auth |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:  auth, password,  | Triage Stage:  Accepted
  reset, passwordreset   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Description changed by Simon Kern:

Old description:

> Accessing the {{{UserAdmin}}} via another model's Admin that has a
> reference to {{{User}}} (with to_field set, e.g., {{{to_field="uuid"}}})
> leads to the {{{UserAdmin}}} being accessed via an url that looks similar
> to this one:
> {{{.../user/----/change/?_to_field=uuid}}}
>

> However the underlying form looks like this:
> {{{
> #!div style="font-size: 80%"
> Code highlighting:
>   {{{#!python
> class UserChangeForm(forms.ModelForm):
> password = ReadOnlyPasswordHashField(
> label=_("Password"),
> help_text=_(
> "Raw passwords are not stored, so there is no way to see this
> "
> "user’s password, but you can change the password using "
> 'this form.'
> ),
> )
> ...
> ...
> def __init__(self, *args, **kwargs):
> super().__init__(*args, **kwargs)
> password = self.fields.get("password")
> if password:
> password.help_text =
> password.help_text.format("../password/")
> ...
> ...
>   }}}
> }}}
>
> This results in the link to the {{{PasswordResetForm}}} being wrong and
> thus ending up in a 404. If we drop the assumption that UserAdmin is
> always accessed via its pk, then we're good to go. It's as simple as
> replacing {{{password.help_text =
> password.help_text.format("../password/")}}} with {{{password.help_text =
> password.help_text.format(f"../../{self.instance.pk}/password/")}}}
>
> I've opened a pull request on GitHub for this Ticket, please see:
> https://github.com/django/django/pull/16139

New description:

 Accessing the {{{UserAdmin}}} via another model's Admin that has a
 reference to {{{User}}} (with to_field set, e.g., {{{to_field="uuid"}}})
 leads to the {{{UserAdmin}}} being accessed via an url that looks similar
 to this one:
 {{{.../user/----/change/?_to_field=uuid}}}


 However the underlying form looks like this:
 {{{
 #!div style="font-size: 80%"
 Code highlighting:
   {{{#!python
 class UserChangeForm(forms.ModelForm):
 password = ReadOnlyPasswordHashField(
 label=_("Password"),
 help_text=_(
 "Raw passwords are not stored, so there is no way to see this
 "
 "user’s password, but you can change the password using "
 'this form.'
 ),
 )
 ...
 ...
 def __init__(self, *args, **kwargs):
 super().__init__(*args, **kwargs)
 password = self.fields.get("password")
 if password:
 password.help_text = password.help_text.format("../password/")
 ...
 ...
   }}}
 }}}

 This results in the link to the {{{PasswordResetForm}}} being wrong and
 thus ending up in a 404. If we drop the assumption that UserAdmin is
 always accessed via its pk, then we're good to go. It's as simple as
 replacing {{{password.help_text =
 password.help_text.format("../password/")}}} with {{{password.help_text =
 password.help_text.format(f"../../{self.instance.pk}/password/")}}}

 I've opened a pull request on GitHub for this Ticket, please see:
 [https://github.com/django/django/pull/16139 PR]

--

-- 
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/010701839fa28f87-25decf04-9ff9-454f-8121-4480a9d1fbed-00%40eu-central-1.amazonses.com.


Re: [Django] #33586: Cannot delete object (A) referenced by another object (B) if said object (A) has a foreign key to a custom user.

2022-10-03 Thread Django
#33586: Cannot delete object (A) referenced by another object (B) if said object
(A) has a foreign key to a custom user.
---+
 Reporter:  Jeremy Poulin  |Owner:  Bhuvnesh
 Type:  Bug|   Status:  assigned
Component:  Migrations |  Version:  4.0
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  1  |  Needs documentation:  0
  Needs tests:  1  |  Patch needs improvement:  1
Easy pickings:  0  |UI/UX:  0
---+
Changes (by Simon Charette):

 * needs_better_patch:  0 => 1
 * has_patch:  0 => 1
 * needs_tests:  0 => 1


Comment:

 > you were right, the problem was inside `RunPython.state_forwards` as it
 is not mutating any state

 Sorry for not being clear but I think you've misinterpreted me here, I
 never stated the issue was in `RunPython.state_forwards` and it's expected
 that it doesn't mutate state as it's an operation that is meant to be used
 for [https://docs.djangoproject.com/en/4.1/topics/migrations/#data-
 migrations data migrations]. The symptoms of the issue, corruption of
 project state, can be observed in `RunPython.state_forwards (and it's
 resulting call in the function provided to `RunPython` initialization as
 reported in this ticket) but it's almost certainly not its cause. In other
 words, `RunPython.state_forwards` cannot be the origin of the state
 corruption because it doesn't mutate it.

 > one thing we can do is clear apps cache inside database_backwards for
 RunPython Operation. This should also not affect the performance much.

 Do you have any numbers to support your performance claim? This is
 important as you are forcing the eviction of a cache layer dedicate to
 making performance better.

 > Ps: Passing all tests.

 That's expected as explained in comment:15 but it cannot be intepreted as
 the proper solution to the problem.

 > Do i need to write regression test also for this?

 Absolutely! You need to demonstrate ''what'' caused the app registry to
 get corrupted in the first place and not only hide it's side effect;
 that's the crux of the issue here.

 Even by putting the performance regression aspect aside I don't think the
 proposed solution is correct. Rendered models are also provided to
 `post_migrate` signal receivers which means that it could be corrupted
 there as well and the solution here **is not** to clear the cache at this
 location 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 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/010701839f1f6e6a-e2cc08a8-e71e-4fbc-adab-2f230e59289c-00%40eu-central-1.amazonses.com.


Re: [Django] #33586: Cannot delete object (A) referenced by another object (B) if said object (A) has a foreign key to a custom user.

2022-10-03 Thread Django
#33586: Cannot delete object (A) referenced by another object (B) if said object
(A) has a foreign key to a custom user.
---+
 Reporter:  Jeremy Poulin  |Owner:  Bhuvnesh
 Type:  Bug|   Status:  assigned
Component:  Migrations |  Version:  4.0
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+

Comment (by Bhuvnesh):

 [https://github.com/django/django/pull/16147 PR]

-- 
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/010701839ef3d449-d84d5606-ee22-4757-9040-7559d5f81217-00%40eu-central-1.amazonses.com.


Re: [Django] #34070: Add support for microseconds to Now() on MySQL and SQLite.

2022-10-03 Thread Django
#34070: Add support for microseconds to Now() on MySQL and SQLite.
-+-
 Reporter:  Mariusz Felisiak |Owner:  Lily
 |  Foote
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak ):

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


Comment:

 In [changeset:"649b28eab6765cd6b2b40c779a18ecafc99b43d7" 649b28e]:
 {{{
 #!CommitTicketReference repository=""
 revision="649b28eab6765cd6b2b40c779a18ecafc99b43d7"
 Fixed #34070 -- Added subsecond support to Now() on SQLite and MySQL.
 }}}

-- 
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/010701839e8b65e0-a68d4c8c-e5ed-4ea1-b94c-61d04bb2b5a6-00%40eu-central-1.amazonses.com.


Re: [Django] #23347: Add --dry-run to migrate

2022-10-03 Thread Django
#23347: Add --dry-run to migrate
---+--
 Reporter:  Richard Eames  |Owner:  nobody
 Type:  New feature|   Status:  closed
Component:  Migrations |  Version:  1.7-rc-3
 Severity:  Normal |   Resolution:  needsinfo
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by Michael):

 The plan option does not help me, it just says `Raw Python operation` for
 my custom migration.

 I just added a error at the end of the migration, so that it rolls back,
 now can run it as many times as desired, then remove the error when
 confident:

 {{{
 from django.db import migrations


 def forwards_func(apps, schema_editor):
 Meeting = apps.get_model("meetings", "Meeting")
 db_alias = schema_editor.connection.alias
 for meeting in Meeting.objects.using(db_alias).all():
 if meeting.meeting_utc is None:
 print(meeting.meeting_date, meeting.meeting_time)
 raise ValueError("Don't commit!")  # <

 class Migration(migrations.Migration):
 dependencies = [
 ('meetings', '0004_meeting_meeting_utc_meeting_time_is_null'),
 ]

 operations = [
 migrations.RunPython(forwards_func),
 ]

 }}}

-- 
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/010701839e5cbe0c-54583b9a-6de2-4645-94a4-d624aedfb88e-00%40eu-central-1.amazonses.com.


Re: [Django] #34068: `runserver 0`'s "Starting development server at " doesn't work

2022-10-03 Thread Django
#34068: `runserver 0`'s "Starting development server at " doesn't work
-+-
 Reporter:  Ruslan   |Owner:  Dhanush
  Oleksandrovich Kovtun  |
 Type:  Bug  |   Status:  assigned
Component:  Core (Management |  Version:  4.1
  commands)  |
 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:  1
-+-
Changes (by Mariusz Felisiak):

 * 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701839d8e6264-bbc02edb-f8d8-47a7-887f-76ee50dd7545-00%40eu-central-1.amazonses.com.


Re: [Django] #34070: Add support for microseconds to Now() on MySQL and SQLite.

2022-10-03 Thread Django
#34070: Add support for microseconds to Now() on MySQL and SQLite.
-+-
 Reporter:  Mariusz Felisiak |Owner:  Lily
 |  Foote
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * stage:  Accepted => Ready for checkin


-- 
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/010701839d2661cb-f642c402-32aa-4283-b574-36915dce95b3-00%40eu-central-1.amazonses.com.


Re: [Django] #32987: Warn user if they attempt to have multiple templatetag libraries with the same name

2022-10-03 Thread Django
#32987: Warn user if they attempt to have multiple templatetag libraries with 
the
same name
-+-
 Reporter:  Daniel   |Owner:  Shreya
 |  Bamne
 Type:  New feature  |   Status:  closed
Component:  Template system  |  Version:  3.2
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  template, check  | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"7843c43c49d3845a1cbebfaaf71f2f0c2a9d8fce" 7843c43c]:
 {{{
 #!CommitTicketReference repository=""
 revision="7843c43c49d3845a1cbebfaaf71f2f0c2a9d8fce"
 [4.1.x] Refs #32987 -- Relaxed system check for template tag modules with
 the same name by turning into a warning.

 Thanks Claude Paroz for the report.

 Regression in 004b4620f6f4ad87261e149898940f2dcd5757ef.
 Backport of f71b0cf769d9ac582ee3d1a8c33d73dad3a770da from main
 }}}

-- 
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/010701839d0ce0e4-66115709-bba6-4de0-82b9-35b5c59d2165-00%40eu-central-1.amazonses.com.


Re: [Django] #32987: Warn user if they attempt to have multiple templatetag libraries with the same name

2022-10-03 Thread Django
#32987: Warn user if they attempt to have multiple templatetag libraries with 
the
same name
-+-
 Reporter:  Daniel   |Owner:  Shreya
 |  Bamne
 Type:  New feature  |   Status:  closed
Component:  Template system  |  Version:  3.2
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  template, check  | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by GitHub ):

 In [changeset:"f71b0cf769d9ac582ee3d1a8c33d73dad3a770da" f71b0cf7]:
 {{{
 #!CommitTicketReference repository=""
 revision="f71b0cf769d9ac582ee3d1a8c33d73dad3a770da"
 Refs #32987 -- Relaxed system check for template tag modules with the same
 name by turning into a warning.

 Thanks Claude Paroz for the report.

 Regression in 004b4620f6f4ad87261e149898940f2dcd5757ef.
 }}}

-- 
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/010701839d0c32fe-2e9b831c-f40d-431e-891e-8a229ac99f68-00%40eu-central-1.amazonses.com.


Re: [Django] #34067: django.core.Paginator wrong query slicing

2022-10-03 Thread Django
#34067: django.core.Paginator wrong query slicing
-+-
 Reporter:  Hristo Trendafilov   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Core (Other) |  Version:  3.2
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:   | Triage Stage:
  Paginator,slice,queryset   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

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


Comment:

 > It is Django fault for those reasons:
 >
 > * `order_by` might be complicated but is supported by the framework
 > * Chained `order_by` is also supported

 Yes, but you should be aware what you are using in the `ORDER BY` clause
 and that some fields may cause issues, e.g. multi-valued fields (see
 [https://docs.djangoproject.com/en/stable/ref/models/querysets/#order-by
 notes in docs]). Django cannot decide for you.

 > * queryset slicing is a feature of Django queryset API.
 > * queryset slicing should act like list and string slicing and namely to
 provide you with results `[ from : to ]` indexes provided and not to
 change or lose data in between. Or in other words - what is passed in the
 `Paginator.object_list` should be just sliced `[ from : to ]`. `Paginator`
 should never care for the queryset, what is the ordering of the queryset,
 what is excluded and so on - it should just work with it.

 This would require fetching all results and slicing on the Python side not
 in the database which is very ineffective and would cause many performance
 issues.

 > * changing `paginate_by` to `10` or greater fixes the problem.
 `paginate_by` is a standard and documented Django ListView setting.
 > * changing `order_by` to some other `order_by` also fixes the problem.
 `order_by` should work the same or if any limitations those should be well
 documented

 Limitations are mostly documented, but we cannot document all caveats.

 > P.S. That is also happening in Django 2.2

 Django 2.2 is not supported anymore, and Django 3.2 is in extended support
 so it receives only security patches.


 I understand that you spend a lot of time trying to debug your issue, but
 we don't have your app, your data, and your database, so we're unable to
 help. Also, Trac is not a support channel.

 I'd like to highly recommend using one of
 [https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
 support channel] where folks will help you. If you'll still be convinced
 that Django is at fault, then please attach a sample minimal project that
 reproduces the issue.

-- 
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/010701839cc81ae9-23d224f1-db83-438d-a48a-822805a104ca-00%40eu-central-1.amazonses.com.


Re: [Django] #34067: django.core.Paginator wrong query slicing

2022-10-03 Thread Django
#34067: django.core.Paginator wrong query slicing
-+-
 Reporter:  Hristo Trendafilov   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Core (Other) |  Version:  3.2
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
  Paginator,slice,queryset   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Hristo Trendafilov):

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


-- 
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/010701839c986c03-6c7f5f64-c645-488d-903e-361dbfc460de-00%40eu-central-1.amazonses.com.


Re: [Django] #34067: django.core.Paginator wrong query slicing

2022-10-03 Thread Django
#34067: django.core.Paginator wrong query slicing
-+-
 Reporter:  Hristo Trendafilov   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Core (Other) |  Version:  3.2
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:   | Triage Stage:
  Paginator,slice,queryset   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Hristo Trendafilov):

 Replying to [comment:6 Hristo Trendafilov]:

 Just added that in the description. At the end of the day, it is expected
 Paginator just slice whatever is provided, not to change or lose data in
 between. Changing `paginate_by` leads to fix and that is a feature of
 Django.

-- 
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/010701839c97cd77-fb73ed32-addb-4d97-90b3-28c39b158ac2-00%40eu-central-1.amazonses.com.


Re: [Django] #34067: django.core.Paginator wrong query slicing

2022-10-03 Thread Django
#34067: django.core.Paginator wrong query slicing
-+-
 Reporter:  Hristo Trendafilov   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Core (Other) |  Version:  3.2
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:   | Triage Stage:
  Paginator,slice,queryset   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by Hristo Trendafilov:

Old description:

> A have a ListView defined like so:
>
> {{{
> class AllPracticesListView(LoginRequiredMixin, PermissionRequiredMixin,
> ListView, ToolBoxFunctions):
> template_name = 'practice_list.html'
> model = Practice
> paginate_by = 6
> permission_required = 'customauth.access_practices'
>
> def get_queryset(self):
> qs = self.get_all_practices_by_user().order_by(
> 'company_branch__pk',
> 'practice_profile__personal_profile__last_name').prefetch_related('practice_profile')
>
> # method < get_all_practices_by_user > is a toolbox method that
> returns:
> #
> Practice.objects.filter(company_branch__owner=self.request.user).order_by('pk')
>
> return qs
>
> }}}
>
> Models are defined like so:
> {{{
>
>  class Practice(models.Model):
> company_branch = models.ForeignKey(
>  CompanyBranch,
>  on_delete=models.PROTECT,
>  related_name='practices',
> )
> # CompanyBranch model has an owner field which ForeignKey
> to the user model
>
> practice_profile = models.ForeignKey(
> PracticeProfile,
> on_delete=models.PROTECT,
> related_name='practices',
> )
>
> class PracticeProfile(models.Model):
> personal_profile = models.ForeignKey(
> PersonalProfile,
> on_delete=models.PROTECT,
> blank=True,
> null=True,
> )
> # PersonalProfile model has a field called <
> last_name >
> }}}
> Or schematically:
> {{{
> Practice object relations:
>   -> CompanyBranch
>   -> PracticeProfile
>   -> PersonalProfile /*NULLABLE RELATION/
>
> }}}
>
> When the code is run, the view does not display results correctly.
>
> I did like so to get the WRONG result:
> Added a breakpoint on  {{{Paginator._get_page}}} return statement
>
> Queryset is passed okay and is available in
> {{{Paginator.object_list}}}
>
> But in the args of {{{Paginator._get_page}}} the queryset is totally
> different than expected / should be a slice from the first six elements
> of {{{Paginator.object_list}}} /
>
> I have tried to add a breakpoint like so
> [[Image(https://imgur.com/SdaQUt6)]]
> Then I get this result [[Image(https://imgur.com/5zzLNV0)]].
>
> As you can see, PKs 1632, 1624, etc. are missing, objects are
> different/marked red and purple/, and are actually removed and never
> shown in the view.
>
> If you run slice manually at this point - everything is again fine
> [[Image(https://imgur.com/yvn8KMO)]]
> This happens only on NULL PersonalProfile objects.
>

> I did like so to get OKAY results:
>
> 1. Added a simple breakpoint is added on {{{Paginator.page}}} like so
> [[Image(https://imgur.com/d7J5BMZ)]] and that breakpoint is just run then
> the result is okay [[Image(https://imgur.com/ILDHAMN)]]
>
> 2. changed paginate_by to 10
>
> 3. changed {{{order_by}}} in {{{get_queryset}}} to {{{-pk}}}
>
> 4. call again the {{{page = paginator.page(page_number)}}}
>
> P.S. That is also happening in django 2.2

New description:

 A have a ListView defined like so:

 {{{
 class AllPracticesListView(LoginRequiredMixin, PermissionRequiredMixin,
 ListView, ToolBoxFunctions):
 template_name = 'practice_list.html'
 model = Practice
 paginate_by = 6
 permission_required = 'customauth.access_practices'

 def get_queryset(self):
 qs = self.get_all_practices_by_user().order_by(
 'company_branch__pk',
 
'practice_profile__personal_profile__last_name').prefetch_related('practice_profile')

 # method < get_all_practices_by_user > is a toolbox method that
 returns:
 #
 Practice.objects.filter(company_branch__owner=self.request.user).order_by('pk')

 return qs

 }}}

 Models are defined like so:
 {{{

  class Practice(models.Model):
 company_branch = models.ForeignKey(
  CompanyBranch,

[Django] #34070: Add support for microseconds to Now() on MySQL and SQLite.

2022-10-03 Thread Django
#34070: Add support for microseconds to Now() on MySQL and SQLite.
-+-
   Reporter:  Mariusz|  Owner:  Lily Foote
  Felisiak   |
   Type:  New| Status:  assigned
  feature|
  Component:  Database   |Version:  dev
  layer (models, ORM)|
   Severity:  Normal |   Keywords:
   Triage Stage:  Accepted   |  Has patch:  1
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 Add support for microseconds to Now() on MySQL and SQLite.

 [https://github.com/django/django/pull/16111 PR]

-- 
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/010701839c75aac6-7d173c97-d37d-402c-843f-7718fcae12fc-00%40eu-central-1.amazonses.com.


Re: [Django] #34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm being broken (404)

2022-10-03 Thread Django
#34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm 
being
broken (404)
-+-
 Reporter:  Simon Kern   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.auth |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:  auth, password,  | Triage Stage:  Accepted
  reset, passwordreset   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Simon Kern):

 * Attachment "patch.diff" 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 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/010701839c73c23e-172288db-8296-4f79-a590-3b19d658649e-00%40eu-central-1.amazonses.com.


Re: [Django] #34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm being broken (404)

2022-10-03 Thread Django
#34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm 
being
broken (404)
-+-
 Reporter:  Simon Kern   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.auth |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:  auth, password,  | Triage Stage:  Accepted
  reset, passwordreset   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Simon Kern):

 * Attachment "patch.diff" added.

 Patch including 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 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/010701839c73c28e-c9680027-e41b-4e31-9425-aa99448cec5d-00%40eu-central-1.amazonses.com.


Re: [Django] #34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm being broken (404)

2022-10-03 Thread Django
#34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm 
being
broken (404)
-+-
 Reporter:  Simon Kern   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.auth |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:  auth, password,  | Triage Stage:  Accepted
  reset, passwordreset   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Simon Kern):

 * Attachment "test.diff" added.

 diff for the test

-- 
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/010701839c71fb37-6560e7d4-b3b0-4994-b966-a2111a2de3bc-00%40eu-central-1.amazonses.com.


Re: [Django] #34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm being broken (404)

2022-10-03 Thread Django
#34066: Accessing UserAdmin via to_field leads to link to PasswordResetForm 
being
broken (404)
-+-
 Reporter:  Simon Kern   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.auth |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:  auth, password,  | Triage Stage:  Accepted
  reset, passwordreset   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-

Comment (by Simon Kern):

 Thanks Carlton and Tim,  I've added a test in {{{UserChangeFormTest
 (auth_tests/test_forms.py)}}}.

-- 
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/010701839c714ebb-d8e3b8dd-f45c-4bac-a3c7-eee052157bab-00%40eu-central-1.amazonses.com.