Opened 13 years ago

Closed 13 years ago

Last modified 13 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: no



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 by anonymous, 13 years ago

Resolution: duplicate
Status: newclosed

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

comment:2 by Luke Plant, 13 years ago

Resolution: duplicatefixed

In [16095]:

Fixed #15688 - Generic views should provide a HEAD implementation

Thanks to j4mie for the report and patch!

comment:3 by Luke Plant, 13 years ago

Easy pickings: unset
Resolution: fixed
Severity: Normal
Status: closedreopened
Type: Uncategorized

Doh, that commit message was meant for #15668.

comment:4 by Luke Plant, 13 years ago

Resolution: duplicate
Status: reopenedclosed

comment:5 by Jacob, 13 years ago

milestone: 1.4

Milestone 1.4 deleted

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