#37168: Readonly fields with db_default display DatabaseDefault representation
-------------------------------------+-------------------------------------
               Reporter:  Mariusz    |          Owner:  Mariusz Felisiak
  Felisiak                           |
                   Type:  Bug        |         Status:  assigned
              Component:  Forms      |        Version:  6.0
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Readonly fields with `db_default` display `DatabaseDefault()`
 representation in the admin. For example:

 - `models.py`
 {{{#!python
 class MyModel(models.Model):
     uuid = models.UUIDField(db_default=UUID7(), editable=False,
 primary_key=True)
     created_datetime = models.DateTimeField(db_default=Now(),
 editable=False)
     modified_datetime = models.DateTimeField(db_default=Now(),
 editable=False)
     name = models.TextField()
 }}}

 - `admin.py`

 {{{#!python
 @admin.register(MyModel)
 class MyModelAdmin(admin.ModelAdmin):
     readonly_fields = ["uuid", "created_datetime", "modified_datetime"]
 }}}


 I think they should be consider as any other empty values.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/37168>
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 visit 
https://groups.google.com/d/msgid/django-updates/0107019ec09a80f2-f17074cf-855c-4a45-b27c-7318e478cae6-000000%40eu-central-1.amazonses.com.

Reply via email to