Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Pass URL variable to formwizard like a normal form in views.py
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
geraldcor  
View profile  
 More options Dec 1 2009, 9:29 pm
From: geraldcor <gregco...@gmail.com>
Date: Tue, 1 Dec 2009 18:29:38 -0800 (PST)
Local: Tues, Dec 1 2009 9:29 pm
Subject: Pass URL variable to formwizard like a normal form in views.py
No normally I can use something lie /foo/edit/35/ and I can edit the
record whose pk is 35. Now with this, I have a url pattern like
(r'^edit/(?P<ssf_id>\d+)/$', 'edit'), which points to def edit
(request, ssf_id): in my views.py.

For my formwizard, by overriding various methods I have successfully
made it so that I can edit an instance by using a view to capture the
above url pattern and instead of passing it to 'edit' I pass it to
'edit_wizard' which looks like this:
@login_required
def edit_wizard(request, ssf_id):
        instance = get_object_or_404(SSF, pk=ssf_id)
        return EDIT_SSFWizard([SSF1, SSF2, SSF3])(request, instance=instance)

This works perfectly. However, there has been a request to have a
listing of the items that the user has already selected so they can
easily see what they have or maybe left off.

Normally I would use something like s=SSF.objects.filter(id=ssf_id)
using the variable from the url and then pass that as a context to the
template so I have my form instance as well as a context full of data.

So I keep putting ssf_id in various methods in my formwizard class to
only have error after error. Any ideas on how to pass this other
variable so I can use the variable to perform a query as below (line
3):

def render_template(self, request, form, previous_fields, step,
max_step, context=None):
                context = context or {}
----------------context=SSF.objects.filter(pk=ssf_id).values
()--------------------------Look at this Line please
                return render_to_response(self.get_template(step), dict
(context=context,
            next_step_field=self.next_step_field_name,
            max_step_field=self.max_step_field_name,
            max_step=max_step,
            step_field=self.step_field_name,
            step0=step,
            step=step + 1,
            step_count=self.num_steps(),
            form=form,
            previous_fields=previous_fields
        ), context_instance=RequestContext(request))


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google