I Am A Begginer Web Developer - Need Help With Finding A Term

39 views
Skip to first unread message

Rok Klancar

unread,
Apr 2, 2019, 1:22:59 AM4/2/19
to Django users
Hello developers!

Much respect to you all.

I have just finished a couple of hours browsing the web, but found no solution. I guess my problem is simply not knowing the right term for the thing that I am trying to make (in Django of course).

Brief description:
I have made a class 'Post' in models.py that represents four different kind of data:
  • Date
  • Int
  • Text 1
  • Text 2
It is sort of like a blog post. Now, in the official Django tutorial I have learned how to make posts appear on separate pages.
But I want the different instances of this class 'Post' appear one under another on a single page (Today's post is on top, yesterday's is bellow the today's, etc.).

I hope I made my issue clear.
I would be happy, just if you told me, how do you call this shape of a page in Web Dev jargon.

Have a nice day
Rok

ANi

unread,
Apr 2, 2019, 3:51:20 AM4/2/19
to Django users
Just query the data maybe by filtering and set the results in different variables, then pass them and you can get different data in one template.
for querying you can see the document

 
hope it helps


Rok Klancar於 2019年4月2日星期二 UTC+8上午9時22分59秒寫道:

nm

unread,
Apr 2, 2019, 1:32:53 PM4/2/19
to Django users
Hi Rok,
I suppose you want to list all your posts :) List is where you display many instances on one page (and your url is e.g. `.../classes/`).
And as you probably already know, if you want to retrieve just one post (or class, or whatever you call it), you need a detail view, and the url will contain the retrieved item's pk (primary key): `.../classes/1`.

Hope this is what you were looking for.
Reply all
Reply to author
Forward
0 new messages