Skip to content

Instantly share code, notes, and snippets.

@blaix
Created August 12, 2015 17:50
Show Gist options
  • Save blaix/b22edf39fed743e13dbf to your computer and use it in GitHub Desktop.
Save blaix/b22edf39fed743e13dbf to your computer and use it in GitHub Desktop.
# If this is the interface:
SiteNavigation(site).as_dict()
# that means we have to have a site object to build a site nav object.
# That's fine within the Site object.
# My point was that if (someday in the future) we need to build a nav object but we only have a site id,
# instead of doing this:
SiteNavigation(Site.objects.get(site_id)).as_dict()
# we could extend the interface to support this:
SiteNavigation.for_site_id(site_id).as_dict()
# We don't need this for what we're talking about.
# I was only making a case that it's ok to accept the object instead of the id since it suits our needs for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment