On Oct 14, 2:26 pm, Aaron <aa...@genieknows.com> wrote: > I have a bunch of models that each have a field X. I want this X to be > unique not just within a particular model (table) but unique across > several models. So, a model of type A can't have a value for its X if > that value is already in the X of a model of type B. > > I get the impression that I'd have to either subclass a model field or > a form field. A model field seems more appropriate, but I can't find > its equivalent of the form field's clean() method where it seems most > appropriate to do the uniqueness checks.
A better way might be to use model inheritance (multitable). The parent model would just include the field you want to be unique, and the subclassed models would include their own fields. You should be able to set unique=True on that one field in the parent model, and it should work. -- DR. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---