Opened 16 years ago

Closed 15 years ago

#8377 closed (duplicate)

unique_for_date (model field option) doesn't work

Reported by: Bela Hausmann <post@…> Owned by: nobody
Component: contrib.admin Version: dev
Severity: Keywords:
Cc: semente@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm not sure why, but I think it is just not implemented in the newforms-admin?

My not working code snipplet:

class BlogEntry(models.Model, generic.Article):
	slug = models.SlugField(_('slug'), unique_for_date = 'published')
	published = models.DateTimeField(_('published'), default = datetime.now(), editable = True)
...

But I don't get any validation errors in my admin interface.

Change History (7)

comment:1 by Guilherme M. Gondim <semente@…>, 16 years ago

Cc: semente@… added

comment:2 by Guilherme M. Gondim <semente@…>, 16 years ago

I have the same problem.

comment:3 by oggie_rob, 15 years ago

I checked on the dev list and there is some work being done with validation at the model level ("model-aware validation").

Most likely this will by fixed with #6845

comment:4 by Gábor Farkas, 15 years ago

i agree that the whole model-aware validation will fix this,
(and have read the thread at http://groups.google.com/group/django-developers/browse_thread/thread/997c0c5eb36eb4f4/8825c573c111c176 )

but please note, that "unique_together" seems to work correctly. so if that can work without validation-aware-models,
this one should be able to work too.. (at least imho)

so, the question is: if someone submits a patch for this, will it get included (and added to 1.0.x), or
the plan is to wait for salvation (validation-aware-models and 1.1.x)

if the answer is the waiting-for-validation-aware-models, then perhaps a note should be added to the documentation,
or a known-bugs document should be created (or is there one? i couldn't find it)

p.s: this whole "unique" situation is quite painful. i mean, we have documentation that documents an attribute
as working, while a quick " grep unique_for_date * -r" shows that the only place where the attribute is mentioned is when the field-object accepts it and stores it inside :-(

comment:5 by anonymous, 15 years ago

Triage Stage: UnreviewedAccepted

comment:6 by Malcolm Tredinnick, 15 years ago

Code that worked for the 1.0.X branch would be appropriate if somebody wanted to write up a patch.

comment:7 by Karen Tracey, 15 years ago

Resolution: duplicate
Status: newclosed

Didn't notice this ticket when #10134 was opened. It's now been fixed, so this one should be covered also.

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