I am using geodjango to create data repository , and have a basic model to store the contents of a shape file . I want to have multiple tables , with attributes generat开发者_运维知识库ed on the fly . There are tables that deal with user , and one table that deal with each shape file .
What I want to know is , I have a basic model that creates a table per shape file . What I want is also another table that deals with the user . So , should I create another model or another class in the same model ?
Thus , if I want to have multiple tables , should I create multiple models or multiple classes ?
If multiple models , then how do I link it to a view ?
A model is merely a programmatic representation of a database table. There's a one-to-one correlation, i.e. for every model you get a database table.
The concept of models is separate from the concept of views. Views are just methods that respond to HTTP requests. In any view you can import and utilize any model; you simply import the model and do whatever you please with it.
It sounds like you're very new to Django and the whole concept of MVC (Model-View-Controller) architecture, in general. You should spend some time reading the Django Book; it's available free online. Focus in particular on the chapters on Models and Views. The Django Documentation is a little more high level but has a wealth of information.
精彩评论