Or better yet, normalize first.

A given Winner can have one or more Fields, so build a Field model
with a ManyToMany relationship to the Winner model, and make it
unique=True and asymmetric.  Work backwards in a similar chain all the
way to Event.

On the other hand, that this set of models will quickly get really
complex is an indicator that your data could stand some further
thought -- how can your model be simplified?  Of course, it could also
just be an indicator that your problem domain really is complex...

---Peter, not the same one ;)



On 6/12/08, Peter Rowell <[EMAIL PROTECTED]> wrote:
>
>> I'd like to store the results for the event, but can't
>> figure out how. The event object is generic, but the results
>> structures are specific to that event.
>
> What first occurs to me is to give the Event class a TextField called
> 'results' which contains a pickled python object/dict/list (whatever)
> of the results. This gives maximum flexibility in what you are storing
> (this is what the django.contrib.sessions code does for session
> variables), but it means that the results are not easily operated on
> by DB calls.
>
> If you do need to have certain operations performed on the results
> (something like "all races that Bob competed in"), you might extract
> that info into a separate text field of comma-separated-values to make
> searching/life easier. If you have many entries for the same
> contestant, you might represent this as a separate mapping model.
> Admittedly this breaks any "normalization" of your data, but that's
> already happened by the variable shape of the results themselves.
> Besides, as someone (who?) said a while ago, normalization is for
> wimps.
>
>   HTH,
>   Peter
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to