How to model government organization hierarchies so that the list can expand and compress
Stéphane Wirtel
stephane at wirtel.be
Thu Aug 13 15:17:44 EDT 2015
Create a model with a parent_id on the current model
and you can use the mptt concept or some others for the reading.
On 13 Aug 2015, at 21:10, Alex Glaros wrote:
> It's like the desktop folder/directory model where you can create
> unlimited folders and put folders within other folders. Instead of
> folders, I want to use government organizations.
>
> Example: Let user create agency names: Air Force, Marines, Navy, Army.
> Then let them create an umbrella collection called "Pentagon", and let
> users drag Air Force, Marines, Navy, etc. into the umbrella
> collection.
>
> User may wish to add smaller sub-sets of Army, such as "Army Jeep
> Repair Services"
>
> User may also want to add a new collection "Office of the President"
> and put OMB and Pentagon under that as equals.
>
> What would the data model look like for this? If I have a field:
> next_higher_level_parent that lets children records keep track of
> parent record, it's hard for me to imagine anything but an inefficient
> bubble sort to produce a hierarchical organizational list. Am using
> Postgres, not graph database.
>
> I'm hoping someone else has worked on this problem, probably not with
> government agency names, but perhaps the same principle with other
> objects.
>
> Thanks!
>
> Alex Glaros
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Stéphane Wirtel - http://wirtel.be - @matrixise
More information about the Python-list
mailing list