Django for Designers: Difference between revisions

Content added Content deleted
imported>Paulproteus
(→‎Add some bookmarks via the command line: Fix typo where "b" was misspelled as "q")
imported>Paulproteus
(→‎Add some bookmarks via the command line: Fix typo where "b" was misspelled as "q")
Line 834: Line 834:
Try getting the ID number of our new bookmark 'b' by typing:
Try getting the ID number of our new bookmark 'b' by typing:


<source lang="python">>>> q.id</source>
<source lang="python">>>> b.id</source>


What happens?
What happens?
Line 844: Line 844:
Get the id of the Bookmark instance. Because it’s been saved, it has an ID in the database now! Even though we didn't specify one in our models.py, every saved model instance automatically has an id field.
Get the id of the Bookmark instance. Because it’s been saved, it has an ID in the database now! Even though we didn't specify one in our models.py, every saved model instance automatically has an id field.


<source lang="python">>>> q.id
<source lang="python">>>> b.id
1</source>
1</source>