views:

17

answers:

1

I select an object (of type SourceClass) from the admin site and get to the 'change' page.

The object I have selected has a ForeignKey relationship to another type of object (TargetClass).

The change page for the object of type SourceClass gives me both a drop down box (from a select form field) and a link to add a new TargetClass.

The url for the add link is: http://localhost:8000/admin/app/sourceclass/add/

The usual behaviour is that I select the add link, create a new TargetClass object (in the pop up window that opens) and after 'Save' is clicked on, my SourceClass object is related to my new TargetClass object.

Now instead of just asking the user to add values for fields for TargetClass, I want to add a few extra steps (e.g. via form wizard).

So far I have updated my urls.conf with

url(r'^admin/app/targetclass/add/$', 'proj.app.views.myaddmethod', name = 'myaddmethod'),

This works fine as my method 'myaddmethod' is called. However, how do I know in the method 'myaddmethod' the particular instance of SourceClass on which the add was called.

My question is, how can I know in my new view which instance of SourceClass was used ? I expect that I would see this in POST data, but it is not there.

A: 

This is add method. The object is not created yet. Do import you model and pass form into new template, then give data via post and save it.

moskrc