[Patchew-devel] [PATCH 06/12] models: create Result model

Paolo Bonzini pbonzini at redhat.com
Tue May 22 15:33:39 UTC 2018


On 22/05/2018 17:14, Fam Zheng wrote:
>>
>> It's not great but I don't have a better idea, it's the best I could do
>> (start) on a plane without StackOverflow. :)  That's also why the series
>> is RFC.
> Maybe we could create a dummy Message for each Project as a host of its results,
> so we can forward the Project.results property to the Message entry? (The same
> applies to ProjectProperty). It's also quite ugly, but perhaps slighly more
> straightforward than this.

I don't know.  That seems uglier, and unlike this it would have
consequences outside the results subsystem (what I like about results is
that they sit on top of the rest, if they disappeared nobody would
notice outside the git and testing plugins).

There must be some way to do it in Django, perhaps with a custom manager
or a custom intermediate table on the many-to-many relation that has an
uniqueness constraint on the result_id.  In the end ManyToManyField is
just a wrapper around a custom manager, itself.

So I think we should look at the database structure and decide if it's
okay.  If it is, how we represent it in Django is relatively
unimportant.  Of the two, I somewhat prefer the two intermediate tables
from ManyToManyField, rather than the two fields in the result tables
from OneToManyField.

Paolo




More information about the Patchew-devel mailing list