Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-05-03 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+-
 Reporter:  wd0517   |Owner:  Bhuvnesh
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  GeneratedField   | 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 nessita <124304+nessita@…>):

 In [changeset:"ac9e18f1c4f17d956d203779df1b22faeffa670f" ac9e18f]:
 {{{#!CommitTicketReference repository=""
 revision="ac9e18f1c4f17d956d203779df1b22faeffa670f"
 [5.0.x] Refs #35359 -- Fixed OperationTests.test_add_generate_field() test
 on PostgreSQL.

 Concat() in Django 5.0 is not immutable on PostgreSQL and cannot be used
 in GeneratedField, see 6364b6ee1071381eb3a23ba6b821fc0d6f0fce75.
 }}}
-- 
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/0107018f41846ddb-a32efd57-7e7c-451c-88c7-650e8c170a04-00%40eu-central-1.amazonses.com.


Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-05-02 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+-
 Reporter:  wd0517   |Owner:  Bhuvnesh
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  GeneratedField   | 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 Natalia <124304+nessita@…>):

 In [changeset:"24f54c3b09ab4f19bfc11c5d7ba80985ed870103" 24f54c3]:
 {{{#!CommitTicketReference repository=""
 revision="24f54c3b09ab4f19bfc11c5d7ba80985ed870103"
 [5.0.x] Fixed #35359 -- Fixed migration operations ordering when adding
 fields referenced by GeneratedField.expression.

 Thank you to Simon Charette for the review.

 Backport of 9aeb38c296c69532c7e64b5e3d706a5eb17b3f12 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/0107018f3c0019c9-a7807879-60c7-4122-922c-83aac3ea8e82-00%40eu-central-1.amazonses.com.


Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-05-02 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+-
 Reporter:  wd0517   |Owner:  Bhuvnesh
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  GeneratedField   | 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 Natalia <124304+nessita@…>):

 In [changeset:"fa202d5cb1f16b9bbfd9da72eb03125fabc34bb8" fa202d5c]:
 {{{#!CommitTicketReference repository=""
 revision="fa202d5cb1f16b9bbfd9da72eb03125fabc34bb8"
 [5.0.x] Refs #34007, Refs #35359 -- Added Q.referenced_based_fields
 property.

 Thank you to Mariusz Felisiak and Natalia Bidart for the reviews.

 Backport of 97d48cd3c6f409584b5cc19fbddfca917bae78fd 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/0107018f3c00197b-45df006e-56a4-4134-a030-c5b9c3c0d717-00%40eu-central-1.amazonses.com.


Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-05-02 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+-
 Reporter:  wd0517   |Owner:  Bhuvnesh
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  GeneratedField   | 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 Natalia Bidart):

 * 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/0107018f3be82708-6c96808b-6fad-47bb-bdee-6d7294c017a3-00%40eu-central-1.amazonses.com.


Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-05-02 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+
 Reporter:  wd0517   |Owner:  Bhuvnesh
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  GeneratedField   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Changes (by nessita <124304+nessita@…>):

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

Comment:

 In [changeset:"9aeb38c296c69532c7e64b5e3d706a5eb17b3f12" 9aeb38c2]:
 {{{#!CommitTicketReference repository=""
 revision="9aeb38c296c69532c7e64b5e3d706a5eb17b3f12"
 Fixed #35359 -- Fixed migration operations ordering when adding fields
 referenced by GeneratedField.expression.

 Thank you to Simon Charette for the review.
 }}}
-- 
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/0107018f3be7d12c-fcaca1e9-dee2-4348-a63c-1c786a82edc4-00%40eu-central-1.amazonses.com.


Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-05-02 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+
 Reporter:  wd0517   |Owner:  Bhuvnesh
 Type:  Bug  |   Status:  assigned
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:
 Keywords:  GeneratedField   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

 In [changeset:"97d48cd3c6f409584b5cc19fbddfca917bae78fd" 97d48cd]:
 {{{#!CommitTicketReference repository=""
 revision="97d48cd3c6f409584b5cc19fbddfca917bae78fd"
 Refs #34007, Refs #35359 -- Added Q.referenced_based_fields property.

 Thank you to Mariusz Felisiak and Natalia Bidart for the reviews.
 }}}
-- 
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/0107018f3a448098-f15608d1-c1ff-4091-853e-0f75a82ee137-00%40eu-central-1.amazonses.com.


Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-04-12 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+
 Reporter:  wd0517   |Owner:  Bhuvnesh
 Type:  Bug  |   Status:  assigned
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:
 Keywords:  GeneratedField   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Changes (by Bhuvnesh):

 * has_patch:  0 => 1
 * owner:  nobody => Bhuvnesh
 * status:  new => assigned

Comment:

 [https://github.com/django/django/pull/18068 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/0107018ed2c9c306-6e5cd1f3-1d84-45c8-b2cc-caedd3f5f3a8-00%40eu-central-1.amazonses.com.


Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-04-12 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+
 Reporter:  wd0517   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:
 Keywords:  GeneratedField   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Comment (by Simon Charette):

 > Hm can't fks depend on these though because the constraints for those
 are also grouped together last. 樂

 Right. Since `GeneratedField` cannot be foreign keys though it should
 still allow for the following grouping of fields?

 `non_fk_non_generated_field | generated_fields | fk_fields`
-- 
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/0107018ed2295305-3a0ab4c1-eb32-461b-a57c-2899dc535bdf-00%40eu-central-1.amazonses.com.


Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-04-09 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+
 Reporter:  wd0517   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:
 Keywords:  GeneratedField   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Comment (by David Sanders):

 > Move "assigned tenant users" into "assigned client users" - need to
 figure out because acu requires an agreement

 Hm can't fks depend on these though because the constraints for those are
 also grouped together last. 樂
-- 
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/0107018ec3bc6118-77296e08-e09a-4902-98f4-f411079295e9-00%40eu-central-1.amazonses.com.


Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-04-07 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+
 Reporter:  wd0517   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:
 Keywords:  GeneratedField   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Changes (by Simon Charette):

 * cc: Simon Charette (added)

Comment:

 Thanks David, I knew this was implemented somewhere but I lost track of
 where exactly!

 I think that relying on this property once it lands is definitely the way
 to go so it's reused by multiple code paths but in the case of stable/5.x
 we might be better off by always adding them last. Thoughts?
-- 
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/0107018eb8c11930-50770c11-574e-4010-a7ff-53a6a4b85120-00%40eu-central-1.amazonses.com.


Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-04-07 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+
 Reporter:  wd0517   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:
 Keywords:  GeneratedField   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Changes (by David Sanders):

 * cc: David Sanders (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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018eb79269a7-8d6c4290-c2e6-474a-9fa0-0d087b8efc3d-00%40eu-central-1.amazonses.com.


Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-04-07 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+
 Reporter:  wd0517   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:
 Keywords:  GeneratedField   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Comment (by David Sanders):

 For anyone picking up this ticket: Simon & I were discussing ways to get
 fields from expressions in this PR:
 https://github.com/django/django/pull/16054
-- 
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/0107018eb7922ec3-2e11bccb-6463-4de9-bd0b-aa283e992868-00%40eu-central-1.amazonses.com.


Re: [Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-04-06 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
-+
 Reporter:  wd0517   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  5.0
 Severity:  Release blocker  |   Resolution:
 Keywords:  GeneratedField   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Changes (by Simon Charette):

 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted

Comment:

 The auto-detector has to be adapted to make the `AddField` of generated
 field depend on any other `AddField` or `AlterField` of field it
 references through `.expression`. Since `GeneratedField` cannot depend on
 other `GeneratedField` the easier way of doing to avoid introspecting
 `.expression` is likely to make them depend on all other
 non-`GeneratedField` fields being added per model so they are always last.
-- 
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/0107018eb6a16bd1-3bb37cb8-cd79-47c7-9e3d-acbd48aadd54-00%40eu-central-1.amazonses.com.


[Django] #35359: Got `django.core.exceptions.FieldError` when adding GeneratedField

2024-04-06 Thread Django
#35359: Got `django.core.exceptions.FieldError` when adding GeneratedField
--+
   Reporter:  wd0517  |  Owner:  nobody
   Type:  Bug | Status:  new
  Component:  Migrations  |Version:  5.0
   Severity:  Normal  |   Keywords:  GeneratedField
   Triage Stage:  Unreviewed  |  Has patch:  0
Needs documentation:  0   |Needs tests:  0
Patch needs improvement:  0   |  Easy pickings:  0
  UI/UX:  0   |
--+
 Here is an exists model

 {{{
 class Foo1(models.Model):
 age = models.IntegerField()
 }}}

 Then adding GeneratedField


 {{{
 class Foo1(models.Model):
 age = models.IntegerField()
 name = models.CharField(max_length=10)
 lower_name = models.GeneratedField(
 expression=Lower("name"),
 output_field=models.CharField(max_length=11),
 db_persist=True,
 )
 }}}

 Run makemigrations get below file


 {{{
 class Migration(migrations.Migration):

 dependencies = [
 ('temp_django_test', '0006_foo1'),
 ]

 operations = [
 migrations.AddField(
 model_name='foo1',
 name='lower_name',
 field=models.GeneratedField(db_persist=True,
 expression=django.db.models.functions.text.Lower('name'),
 output_field=models.CharField(max_length=11)),
 ),
 migrations.AddField(
 model_name='foo1',
 name='name',
 field=models.CharField(default='a', max_length=10),
 preserve_default=False,
 ),
 ]
 }}}


 Then run migrate, will got error


 {{{
 temp-django-5.0 ❯ python manage.py migrate
 Operations to perform:
   Apply all migrations: admin, auth, contenttypes, sessions,
 temp_django_test
 Running migrations:
   Applying temp_django_test.0007_foo1_lower_name_foo1_name...Traceback
 (most recent call last):
   File "/Users/wangdi/Desktop/test_scripts.nosync/temp-
 django-5.0/manage.py", line 22, in 
 main()
   File "/Users/wangdi/Desktop/test_scripts.nosync/temp-
 django-5.0/manage.py", line 18, in main
 execute_from_command_line(sys.argv)
   File "/Users/wangdi/Desktop/test_scripts.nosync/temp-
 django-5.0/.venv/lib/python3.11/site-
 packages/django/core/management/__init__.py", line 442, in
 execute_from_command_line
 utility.execute()
   File "/Users/wangdi/Desktop/test_scripts.nosync/temp-
 django-5.0/.venv/lib/python3.11/site-
 packages/django/core/management/__init__.py", line 436, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/Users/wangdi/Desktop/test_scripts.nosync/temp-
 django-5.0/.venv/lib/python3.11/site-
 packages/django/core/management/base.py", line 413, in run_from_argv
 self.execute(*args, **cmd_options)
   File "/Users/wd0517/Desktop/test_scripts.nosync/temp-
 django-5.0/.venv/lib/python3.11/site-
 packages/django/core/management/base.py", line 459, in execute
 output = self.handle(*args, **options)
  ^
   File "/Users/wd0517/Desktop/test_scripts.nosync/temp-
 django-5.0/.venv/lib/python3.11/site-
 packages/django/core/management/base.py", line 107, in wrapper
 res = handle_func(*args, **kwargs)
   
   File "/Users/wd0517/Desktop/test_scripts.nosync/temp-
 django-5.0/.venv/lib/python3.11/site-
 packages/django/core/management/commands/migrate.py", line 356, in handle
 post_migrate_state = executor.migrate(
  ^
   File "/Users/wd0517/Desktop/test_scripts.nosync/temp-
 django-5.0/.venv/lib/python3.11/site-
 packages/django/db/migrations/executor.py", line 135, in migrate
 state = self._migrate_all_forwards(
 ^^^
   File "/Users/wd0517/Desktop/test_scripts.nosync/temp-
 django-5.0/.venv/lib/python3.11/site-
 packages/django/db/migrations/executor.py", line 167, in
 _migrate_all_forwards
 state = self.apply_migration(
 ^
   File "/Users/wd0517/Desktop/test_scripts.nosync/temp-
 django-5.0/.venv/lib/python3.11/site-
 packages/django/db/migrations/executor.py", line 252, in apply_migration
 state = migration.apply(state, schema_editor)
 ^
   File "/Users/wd0517/Desktop/test_scripts.nosync/temp-
 django-5.0/.venv/lib/python3.11/site-
 packages/django/db/migrations/migration.py", line 132, in apply
 operation.database_forwards(
   File "/Users/wd0517/Desktop/test_scripts.nosync/temp-
 django-5.0/.venv/lib/python3.11/site-
 packages/django/db/migrations/operations/fields.py", line 108, in
 database_forwards
 schema_editor.add_field(
   File "/Users/wd0517/Desktop/test_scripts.nosync/temp-
 django-5.0/.venv/lib/python3.11/site-