Path: csiph.com!news.mixmin.net!news2.arglkargh.de!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'hierarchical': 0.07; 'cc:addr:python-list': 0.09; 'subject:How': 0.09; 'objects.': 0.09; 'example:': 0.10; 'subject: \n ': 0.15; '@matrixise': 0.16; 'drag': 0.16; 'from:addr:stephane': 0.16; 'from:addr:wirtel.be': 0.16; 'from:name:st\xc3\xa9phane': 0.16; 'from:name:wirtel': 0.16; 'message-id:@wirtel.be': 0.16; 'postgres,': 0.16; 'received:mx1.wirtel.be': 0.16; 'received:wirtel.be': 0.16; 'st\xc3\xa9phane': 0.16; 'umbrella': 0.16; 'url:wirtel': 0.16; 'wirtel': 0.16; 'wrote:': 0.16; 'alex': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.24; 'sort': 0.25; 'subject:list': 0.26; 'repair': 0.29; 'subject:that': 0.29; "i'm": 0.30; 'url:mailman': 0.30; 'received:be': 0.30; 'probably': 0.31; 'url:python': 0.33; 'lets': 0.33; 'url:listinfo': 0.34; 'thanks!': 0.34; 'this?': 0.34; 'worked': 0.34; 'add': 0.34; 'but': 0.36; 'instead': 0.36; 'url:org': 0.36; 'smaller': 0.36; 'subject:: ': 0.37; 'list.': 0.37; 'anything': 0.38; 'someone': 0.38; 'data': 0.39; 'subject:the': 0.39; 'received:192': 0.39; 'url:mail': 0.40; 'where': 0.40; 'called': 0.40; 'some': 0.40; 'collection': 0.60; 'within': 0.64; 'air': 0.65; 'received:176': 0.66; 'records': 0.70; 'wish': 0.71; 'hoping': 0.77; 'folders.': 0.84; 'received:176.31': 0.84; 'inefficient': 0.91; 'received:192.168.0.5': 0.91; 'imagine': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wirtel.be; s=default; t=1439493143; bh=QgsQkUuF3ESDHJcTB/XMTQ770lFvJ1JrLxvKgQbztsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ux/sa1Fsa0Tf/gvnGsBbR7gRIuCFlmqQdV49LOyHGKJ8S6FJ2rjPN3vgcINrd/6Mp /oceE20Adf6Tv8gStBb0mq0eh2BJdceGYty6303Z96qc13HZTynJk7+QUpWK7sA6t0 Xtl1Qq87GI6nLvEActoNpKlGwZpiNd7lzPADSi8PBWgWllCqqVZjcZJVueRnThF77d hKmZIfiB19KrLooOYZn/2EBfHy1okSv0UnV+4GKjWsMh4ImrcD4IeM0KPnzQiwq3ue odtarcs1jTNXDml3JeRGPT6hg7yWlrVFx+oHKjoKS6T2vGIVl0mw73y/LRpSCyEdNn Gx0nv5AQoPkQA== From: "=?utf-8?q?St=C3=A9phane?= Wirtel" To: "Alex Glaros" Cc: python-list@python.org Subject: Re: How to model government organization hierarchies so that the list can expand and compress Date: Thu, 13 Aug 2015 21:17:44 +0200 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailer: MailMate (1.9.2r5107) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1439493467 news.xs4all.nl 2848 [2001:888:2000:d::a6]:47303 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95354 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