Re: base implementations of natural key methods

2014-06-24 Thread Russell Keith-Magee
Hi Jian, Apologies for the delay in responding. On Thu, May 8, 2014 at 9:44 AM, Jian Li wrote: > Hi Russ, > > Thanks for the feedback! > > I believe the proposed code already addresses points 1-4. > > 1) The implementation does in fact return the correct natural key, > `(self.username,)`, for

Re: base implementations of natural key methods

2014-05-07 Thread Jian Li
Hi Russ, Thanks for the feedback! I believe the proposed code already addresses points 1-4. 1) The implementation does in fact return the correct natural key, `(self.username,)`, for the User model. 2) When multiple fields have `unique=True`, the implementation does not choose from among them;

Re: base implementations of natural key methods

2014-05-07 Thread Russell Keith-Magee
On Wed, May 7, 2014 at 10:20 AM, Jian Li wrote: > Hi! > > In the course of implementing `natural_key` for many different models, > I've noticed that the implementation is fairly predictable; it tends to use > the fields already marked as unique. To avoid writing a separate > implementation for ea

base implementations of natural key methods

2014-05-06 Thread Jian Li
Hi! In the course of implementing `natural_key` for many different models, I've noticed that the implementation is fairly predictable; it tends to use the fields already marked as unique. To avoid writing a separate implementation for each model, I've written a patch that implements the relevant l