Accessing data entered into multiple Django forms and generating them onto a new URL
Posted
by pedjk
on Stack Overflow
See other posts from Stack Overflow
or by pedjk
Published on 2010-04-16T19:13:13Z
Indexed on
2010/04/16
20:13 UTC
Read the original article
Hit count: 237
I have a projects page where users can start up new projects. Each project has two forms.
The two forms are:
class ProjectForm(forms.Form):
Title = forms.CharField(max_length=100, widget=_hfill)
class SsdForm(forms.Form):
Status = forms.ModelChoiceField(queryset=P.ProjectStatus.objects.all())
With their respective models as follows:
class Project(DeleteFlagModel):
Title = models.CharField(max_length=100)
class Ssd(models.Model):
Status = models.ForeignKey(ProjectStatus)
Now when a user fills out these two forms, the data is saved into the database. What I want to do is access this data and generate it onto a new URL. So I want to get the "Title" and the "Status" from these two forms and then show them on a new page for that one project. I don't want the "Title" and "Status" from all the projects to show up, just for one project at a time. If this makes sense, how would I do this?
I'm very new to Django and Python (though I've read the Django tutorials) so I need as much help as possible.
Thanks in advance
Edit:
The ProjectStatus code is (under models):
class ProjectStatus(models.Model):
Name = models.CharField(max_length=30)
def __unicode__(self):
return self.Name
© Stack Overflow or respective owner