localwiki/sapling — Issue #122: Think about slugs vs. foreignkeys
Author: philipn
Created: 2011-11-24 10:01:11+00:00
State: open

RE: foreignkey / slug on pages.

Yeah, that works too. It's a bit of a conundrum.

Mike:

I think I ranted about this before but want to write it down somewhere. I think long-term it would be good to settle this in a generic way. Can't believe I haven't seen this pattern somewhere, but what I imagine is something like a slug-like object that is basically just a namespace, and you can put stuff in there like a page, map, files, etc, and then you can define custom behaviors when those things get deleted, renamed, etc. So when a page gets deleted, we dump the whole namespace and everything it had. Another option would be for maps specifically to be decoupled from pages (which I think may be useful in 3-4 years if/when map data volume starts to get overwhelming) so that map objects can optionally link to a page, or to an image, or something else entirely, and the map is sort of like a page with links. Might be architecture astronauting, though.

Philip:

Yeah, that would be useful. Maybe something like a WeakForeignKey field or SlugKeyField something?