mysociety / pombola

GNU Affero General Public License v3.0
65 stars 41 forks source link

add 'on_behalf_of' to Position to track party membership #2245

Open mhl opened 7 years ago

mhl commented 7 years ago

Displaying a party for each person which a particular type of position is expensive - Person.parties calls makes two queries, and that happens for each person. (e.g. this happens on pages like: http://www.pa.org.za/position/member/parliament/?order=name )

We should add the Popolo-recommended on_behalf_of property (a foreign key to an Organisation) to indicate the party that a membership was associated with, which will make all of these pages less expensive to generate.

mhl commented 7 years ago

I thought I should add a plan for this, since I won't be around to work on it initially, in all probability.

n.b. the Popolo specification's "Membership" corresponds closely to a Position in Pombola. The meaning of on_behalf_of is described here: http://www.popoloproject.com/specs/membership.html

After doing this, the next things to consider are:

(I hope this is fairly coherent and sensible - I'm still rather unwell, so might not be thinking straight about this.)