Thursday, October 28, 2010

Forms in a Workflow for Related Models

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.

No comments:

Post a Comment