Tasks
- 1 Prerequisites and Installation
- 2 Suggestions for class project
- 3 Describing Web Application Systems
Displaying 3 of 8 total tasks See All Tasks »
Activity Wall
posted message: For example sake, let say we have two models a Project and Student model. The Project model has two fields(name and num_of_students) and the Student model has two fields(name and project) but the project field of the Student model is a ForeignKey(Project). Know I know to fill out data to the project model, I will write something like:
>> p = Project(name='Django', num_of_students=1)
>>p.save()
But for the Student field I am confused on how to fill any data I got a solution from the Django online documentation which was about a Blog scenario but I am confused on how to implement the solution.
Can any one maybe try to fill out any sort of data for the Student model
so I can see how it is done so I can understand this part. Thanks
09 Aug 2011
via
courses.p2pu.org
1 Comment
posted message: Hi everyone, I need some help with my django model, particularly on ForeignKey and ManyToMany Fields. The problem is I am not able to create object for these fields(not able to fill in and save data). The first time I tried I got a value error (ValueError) that says the Model.field must be an instance of another model so I checked for solutions and found some but now I am more confuse on how to implement these solutions, so I was hopping any one could give me an example on how the following hypothetical models could be filled and with that I would understand better. So I will send a second message that will simulate a School data and will help you understand my problem better.
Thanks.