On Tue, Mar 15, 2011 at 11:11 PM, Andrew Godwin <and...@aeracode.org> wrote: > On 14/03/11 21:14, Michal Petrucha wrote: >> >> Good evening (or whatever it is in everyone's timezone). >> >> I'm an undergrad computer science student at the Faculty of >> Mathematics, Physics and Informatics, Commenius University, >> Bratislava, Slovakia and I'm willing to participate in this year's >> GSoc. I'm interested in fixing the six-year-old open ticket in trac >> concerning the subject, http://code.djangoproject.com/ticket/373 > > Firstly, thanks for proposing a GSoC project - it's always nice to have more > students. Bear in mind that the list of accepted organisations hasn't been > published yet, but we're pretty hopeful Django will make it in again this > year.
I'd like to second what Andrew has said. This is definitely a project with enough meat to fill a GSoC, and it's something that has been on Django's wish list for a long time. I also agree with Andrew's answers to your questions, with one exception: >> - The composite primary key would be specified as a tuple of strings >> in a primary_key attribute inside a model's Meta class instead of >> having a field with primary_key=True. > > That seems to match with our current handling of things like unique, so that > seems fairly reasonable. The difference between primary_key and unique is that you can have multiple unique conditions, including a number of individual field uniques *plus* a series of grouped uniques. However you can only have one primary key field (or field set). I'd like to suggest an alternate representation. At present, you can make any field a primary key by setting primary_key=True on that field. The Meta class then validates to ensure that there is only one field that has that attribute set (and inserts an AutoField if no field has it set). Another way to represent primary keys would be to relax this validation constraint. If you mark no field as primary_key=True, then an AutoField is added. If you mark one field, then that field is the primary key. And if you mark multiple fields, then you have a composite primary key composed of those fields. This removes the need to introduce a new Meta flag, but more importantly, it means you won't have to resolve discrepancies between fields with primary_key and a Meta.primary_key option. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.