← Back to team overview

ubuntu-accomplishments-contributors team mailing list archive

Re: django model inheritance dilemma

 

On 11 March 2012 03:36, Janos Gyerik <janos.gyerik@xxxxxxxxx> wrote:
> Hi,
>
> I have a bit of a dilemma. We have an AccomplishmentBase model, which
> is extended by Accomplishment and AccomplishmentProposal models, with
> common properties in AccomplishmentBase and custom extra properties
> are in the children. A bit of a problem here is that Accomplishment
> should have some built in uniqueness checks, maybe application +
> descriptor should be unique together. At the same time, there should
> be no uniqueness checks on AccomplishmentProposal. Right now there are
> no uniqueness checks, which is fine for AccomplishmentProposal, but
> Accomplishment needs extra care.
>
> How can we do this nicely in Django? Any ideas are welcome!

In terms of uniqueness for Accomplishments, there should only ever be
one application+descriptor combination (the descriptor has to be
unique that specific accomplishment, and there can only be one of
those in each accomplishment set (the application refers to the
accomplishment set). As an example, there should only be one
'filed-first-bug' in 'ubuntu-community', but there is nothing wrong
with there being a 'filed-first-bug' in 'thunderbird-community' if
that was a set too.

In terms of the AccomplishmentProposal uniqueness question, I am not
sure what you mean by it being unique?

> PS: on a related note, we put .application in Accomplishment, but
> maybe it's better in AccomplishmentBase? Just wondering...

Makes sense to me.

   Jono

-- 
Jono Bacon
Ubuntu Community Manager
www.ubuntu.com / www.jonobacon.org
www.identi.ca/jonobacon www.twitter.com/jonobacon


Follow ups

References