Looking to create rich web applications with Python? Python has an excellent web framework called Django that has an passionate and active community behind it. It is production ready and takes care of a lot of the basic demands of a web application such as authentication, templating, and a pythonic interface for databases.
publicó mensaje: 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)
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
publicó mensaje: 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.