Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>No, you do not need to create a separate app for each model. You should create an application for each distinct set of functionality in your project. Since you're just learning, you should create one application (with the name of your project) and use that to learn. </p> <p>As for the models, they are just a representation layer of the tables in your db that makes it easy and handles a lot of the heavy lifting associated with interacting with your db. So in your case you would create a model for each table in your existing db: Widget, Creator (you may want to consider making this a foreign key link to your User table), Customer, Order. </p> <p>The way you return specific data is through your views. So for example to get all the data for a specific widget using the url in your example, the url /widget/1234 would point to a function on your views.py page where you would query your db for the information you need, and send it to your template. In your example the query would look something like:</p> <pre><code>widget = Widget.objects.get(id=1234) </code></pre> <p>Note that since you have an existing database you will have to override Django's default db naming conventions. You can read more about how to do that here: <a href="https://docs.djangoproject.com/en/dev/topics/db/models/" rel="nofollow">https://docs.djangoproject.com/en/dev/topics/db/models/</a></p> <p>However the best advice I can give you would be to put your own project/app aside for a couple of days and go through the official Django tutorial and documentation. Especially when you're first learning, its incredibly well documented and easy to learn:</p> <p><a href="https://docs.djangoproject.com/en/dev/" rel="nofollow">https://docs.djangoproject.com/en/dev/</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload