#35019: GeneratedField save error
-------------------------------------+-------------------------------------
               Reporter:  Deb Kumar  |          Owner:  nobody
  Das                                |
                   Type:  Bug        |         Status:  new
              Component:             |        Version:  5.0
  Uncategorized                      |       Keywords:  GeneratedField save
               Severity:  Normal     |  error
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 When using GeneratedField column along with a ForeignKey column, getting
 error while saving.
 The below model throws error while saving data from admin panel.
 {{{
 #!python
 class Square(models.Model):
     id = models.BigAutoField(primary_key=True)
     side = models.IntegerField()
     area = models.GeneratedField(
         expression=F("side") * F("side"),
         output_field=models.BigIntegerField(),
         db_persist=True,
     )
     user = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
 }}}

 Throws the below error

 {{{
 Cannot force an update in save() with no primary key.
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/35019>
Django <https://code.djangoproject.com/>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018c3e894949-da72d495-9cef-4059-bd69-b979a097375e-000000%40eu-central-1.amazonses.com.

Reply via email to