Opened 6 years ago

Closed 6 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:

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_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 6 years ago by anonymous

Resolution: duplicate
Status: newclosed

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

comment:2 Changed 6 years ago by Luke Plant

Resolution: duplicatefixed

In [16095]:

Fixed #15688 - Generic views should provide a HEAD implementation

Thanks to j4mie for the report and patch!

comment:3 Changed 6 years ago by Luke Plant

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

Doh, that commit message was meant for #15668.

comment:4 Changed 6 years ago by Luke Plant

Resolution: duplicate
Status: reopenedclosed

comment:5 Changed 5 years ago by Jacob

milestone: 1.4

Milestone 1.4 deleted

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