Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#15688 closed Uncategorized (duplicate)

unique_for_date validation doesn't run with admin readonly_fields

Reported by: jacob Owned by: nobody
Component: contrib.admin Version: 1.3
Severity: Normal Keywords: admin readonly_fields unique_for unique_for_date
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX:



import datetime
from django.db import models

class Entry(models.Model):
   title = models.CharField(max_length=255)
   slug = models.SlugField(unique_for_date='created')
   created = models.DateField(


from django.contrib import admin
from .models import Entry, readonly_fields=['created'])

With this, I'm able to create multiple entries with the same created date. If I remove created field from readonly_fieldsvalidation fires as expected.

Also see this django-users thread reporting something similar with auto_now and editable=False.

Change History (5)

comment:1 Changed 5 years ago by anonymous

  • Resolution set to duplicate
  • Status changed from new to closed

readonly fields are excluded, so I believe the problem here is the same as #13091.

comment:2 Changed 5 years ago by lukeplant

  • Resolution changed from duplicate to fixed

In [16095]:

Fixed #15688 - Generic views should provide a HEAD implementation

Thanks to j4mie for the report and patch!

comment:3 Changed 5 years ago by lukeplant

  • Easy pickings unset
  • Resolution fixed deleted
  • Severity set to Normal
  • Status changed from closed to reopened
  • Type set to Uncategorized

Doh, that commit message was meant for #15668.

comment:4 Changed 5 years ago by lukeplant

  • Resolution set to duplicate
  • Status changed from reopened to closed

comment:5 Changed 5 years ago by jacob

  • milestone 1.4 deleted

Milestone 1.4 deleted

Note: See TracTickets for help on using tickets.
Back to Top