Russ,

Wow, thanks so much for clearing that up, I was never sure about the
parameters part of the URL, since this is my first real web program
EVER, and I figured django was the right way to go.

Does caching matter that much in my example, since it's dynamic data
anyway?

John


On Jul 19, 5:43 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 7/20/07, John M <[EMAIL PROTECTED]> wrote:
>
>
>
> >http://.../model3/add/#   - calls a view to add a new model3, with
> > foreign key model2 of #
> >http://.../model3/edit/#   - calls a view to edit a model3 of ID#
>
> > It seems simple enough, but wanted to get everyones feedback on
> > anything I'm missing, or is it just this simple?
>
> It's pretty much that simple, although there are a few details I would 
> suggest:
>
> - You have add and edit views, but no 'view' view - i.e., just show me
> the object. The best place for this is probablyhttp://.../model1/#
> for model1, ID # (repeated for other models). Alternatively, if there
> is no such thing as a non-editing view - if you want an object to be
> editable whenever it is viewed, just make thehttp://.../model1/#view
> the edit view. If you do this, make sure you do a HttpResponseRedirect
> when you POST to prevent the POST request ending up in the browser
> history.
>
> - You might want to have a think about your method of foreign key
> hinting using the URL. Each URL should be a unique, cachable resource
> - in this case, "add an instance of model3". Adding
> transient/suggested data to your URL would generally violate this
> principle. On top of that, what do you do to the URL space if you need
> to specify 2 foreign keys?
>
> A alternate approach would be to pass in the preferred foreign key as
> part of the GET dictionary i.e., your request would be:
> /model3/add/?model1=3. That way, there is only 1 URL resource (the add
> page at /model3/add/), and the view can still work if you have no or
> multiple specified foreign key references (just modify the handling of
> the GET dictionary to inspect 0, 1 or many keys).
>
> Yours,
> Russ Magee %-)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to