Friday, October 29, 2010

Re: Forms in a Workflow for Related Models

Hi,

You will need to go step by step. First you ask the user for the reviewer with a form. Then the user has to submit the form. You manage your input form and see if the data for that reviewer already exists, if it does, then you load initial data in the second form. Now you redirect the user to the second form, empty or loaded. This is the usual HTML web application flow, not related to Django.

If you want things to happen dynamically, you will have to use AJAX, you can use any JS library you like. 

Best regards,
Miguel 



2010/10/29 ghachey <ghachey@gmail.com>
Hi,

I think I have a particular case.  I could not find an easy way to do
this going carefully through all the documentation.  I also couldn't
find anything close enough in these archives to help me out with my
limited experience so I am resorting to asking you.

I have a Paper model which records research paper information
(references for a given paper).  And, I have a Questionnaire model
which records a questionnaire instance for a given paper instance.
They look like this,

class Paper(models.Model):
 author = models.CharField(max_length=256)
 title = models.CharField(max_length=256)
 .
 .

class Questionnaire(models.Model):
 paper = models.ForeignKey(Paper,
db_column='paper_fk',blank=True,null=True)
 reviewer = models.CharField(
       verbose_name="Who is the reviewer?",
       max_length=5,choices=REVIEWERS,unique=True)
 question1 = models.CharField(max_length=256)
 .
 .

I have a view that pulls all paper instances (for a particular
research) showing the title and the abstract only on a page.  I would
like to be able to click on the title of any one of the papers opening
a new browser window in which I could complete a questionnaire for
that particular paper.

Ideally, it would ask first which *reviewer* would like to submit (or
update) a questionnaire for that paper (see the Questionnaire model).
Subsequently, it would show an empty Questionnaire form (if reviewer
has not submitted a questionnaire for that paper yet) or the
previously submitted instance of that questionnaire for that paper by
that reviewer.

I simply cannot find an easy way of achieving this.  I have looked at
inline formset (with online one inline), a combination of forms, etc.
but none of those seem to do what I want easily.

Any ideas would be greatly appreciated, even telling me to do this in
a completely different way.

Thank you,

--
GH

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment