#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 |
Description
Model:
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(default=datetime.date.today)
Admin:
from django.contrib import admin from .models import Entry admin.site.register(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_fields
validation fires as expected.
Also see this django-users thread reporting something similar with auto_now
and editable=False
.
Change History (5)
comment:1 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:3 by , 14 years ago
Easy pickings: | unset |
---|---|
Resolution: | fixed |
Severity: | → Normal |
Status: | closed → reopened |
Type: | → Uncategorized |
Doh, that commit message was meant for #15668.
comment:4 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
Note:
See TracTickets
for help on using tickets.
readonly fields are excluded, so I believe the problem here is the same as #13091.