Hey Folks,
  Teams I have been on in the past have used natural keys extensively. As a 
result many people have complained about the current way to implement them. 
Not only do you have to implement two methods that are the reverse of each 
other in a compatible way, but you also need to remember to attach the 
manager which you created to the model. None of these steps are hard, but 
some are easy to typo, and when a typo is made error messages can be sort 
of confusing to debug. The best example is if the manager is missing the 
get_by_natural_key method, is it really missing on the manager or is the 
wrong manager on the model.
  The solution I propose is a meta field on the model that allows you to 
set natural keys there. If done in a way where it was backwards compatible 
it could be added without breaking existing functionality. I already have 
code for it and put in a ticket 
<https://code.djangoproject.com/ticket/23780>. After some extensive 
feedback from freakboy3742 (thank you btw), timgraham recommended that I 
bring this up on the developers mailing list if I feel strongly about it. 
So here I am. I am willing to continue work on this code if someone 
proposes a change that they think would be necessary to accept this idea.

Brian

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/8a17ce37-0ce4-4648-bcc6-8d6cfe35e4e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to