Skip to content

Instantly share code, notes, and snippets.

@darkwing
Created July 9, 2012 19:59
Show Gist options
  • Save darkwing/3078551 to your computer and use it in GitHub Desktop.
Save darkwing/3078551 to your computer and use it in GitHub Desktop.
parent_id = request.POST.get('parent_id', '')
# Attempt to set a parent
if show_translation_parent_block and parent_id:
try:
parent_doc = get_object_or_404(Document, id=parent_id)
doc.parent = parent_doc
except Document.DoesNotExist:
logging.debug('Could not find posted parent')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment