I was reading the article on Django Form Validation -
http://code.google.com/appengine/articles/djangoforms.html - and came
across using db.Key.from_path as a way to access a model instance.
But, I'm wondering if there's any real difference or preferred method
between these two approaches below?  If you have the key, why not just
use the stringified version of it directly instead of constructing the
key from its Id?

1)
Template: a href="item/edit?key={{ item.key }}"

Code:
        key = self.request.get('key')
        item = Item.get(db.Key(key))

2)
Template: a href="item/edit?id={{ item.key.id }}"

Code:
        id = int(self.request.get('id'))
        item = Item.get(db.Key.from_path('Item', id))


Any insight?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to