I would recommend you reading this blog by James Bennet:

http://www.b-list.org/weblog/2006/11/16/django-tips-get-most-out-generic-views

it has some great tips on using and extending generic views...

On 1/14/07, qhfgva <[EMAIL PROTECTED]> wrote:

So far I've been using generic views for everything so I'm not sure if
I've reached the end of what those can do, or just need some better
understanding of how to use them.

prabably the easiest way is to create a very simple wrapper around the
generic view that will take care of the values you want to populate
yourself.


I have a Foo model and a Goo model which among other attributes has a
non-editable ForeignKey reference back to Foo.  I'm having trouble
conceptualizing how I should handle getting the foo_id value set
automagically in a goo instance at the time it is created.

As a guess I was thinking that I could pass an instance of foo_id as
part of the extra_context value, but I'm not sure how I could grab this
value and put it in place in the urls.urlpatterns:

(r'^goo/create/$',  'django.views.generic.create_update.create_object',
{'model': Goo, 'post_save_redirect':"/goo/%(id)s/", extra_context:
{'foo_id' : ?????}}),

And if I do figure out how to pass foo_id thru, I'm not sure how this
will interact with the template.  As a hidden parameter called foo_id
or id_foo_id?

if you would put it in your form as a hidden field, snybody with basic
knowledge of html (or http) will be able to override that value and
submit their own, the only way to handle this securely is on the
server side


Any hints on this would be greatly


>



--
Honza Kr l
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
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