#15953: Allow setting individual fields as 'unique' from the model Meta options -------------------------------------+------------------------------------- Reporter: julien | Owner: nobody Type: New | Status: new feature | Component: Database layer Milestone: | (models, ORM) Version: 1.3 | Severity: Normal Resolution: | Keywords: Triage Stage: Design | Has patch: 0 decision needed | Needs tests: 0 Needs documentation: 0 | Easy pickings: 0 Patch needs improvement: 0 | -------------------------------------+-------------------------------------
Comment (by julien): That's fair enough. Thanks for your feedback. I'm not too precious about this and I won't mind if it gets wontfixed. Just for the sake of argumentation, the case could also be made that the framework could allow the overriding of certain field properties at the `Model` level, in the same way as, like noted above, a form field's `widget` property can be overridden at the `ModelForm` level. Purely as a convenience. Also, I often see many of the constraints linked to model inheritance, like to one pointed out by this ticket, quite unfortunate as they drastically limit the possibilities of making apps reusable. In my case, it's a shame that the abstract class `A` cannot be reused so easily in any context, where certain of its fields may or may not be unique. One approach would be to have the app ship some mixins `A1` and `A2`, both defining a `blah` field but the former setting `unique=False` and the latter `unique=True`. But again, this would mean the app would have to anticipate every use case it might be used in, which again goes against the principles of reusability. Anyway, for me this would be a nice-to-have feature rather than something essential. Maybe this is also highlighting some bigger issues with Django's handling of model inheritance and therefore should be part of a broader discussion. -- Ticket URL: <http://code.djangoproject.com/ticket/15953#comment:9> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.