Okay, I've got one more question.  If we're not going to support
querying for an object's real type, it becomes quite cumbersome to do
anything polymorphically, which kind-of is the point of
object-orientation.

For example, to use the same URI spec & view for all the subtypes.

OPTION 1: lots of if-then-else's

  def detail_view(id):
      place = Place.objects.get(id)
      if place.isinstance(Place): model_name = 'Place'
      elif place.isinstance(Restaurant): model_name = 'Restaurant'
      ...
      return render_to_response("templates/place_%s.html" % model_name,
place)

OPTION 2: embed the type in the URI

  def detail_view(model_name, id):
      ... # or map to a different view altogether

Neither seem like very good solutions to me.  Am I missing something?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to